Release #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
description: What is the release tag? | |
required: true | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run tests | |
run: bun run test | |
- name: Build binary | |
run: bun run build:bin | |
- name: Build smol | |
run: bun run build:smol | |
- name: Set release | |
shell: bash | |
run: | | |
export VERSION="${{ github.event.inputs.tag }}" | |
export ARCH=x86_64-linux | |
export APP=helix-gpt | |
export OUTPUT="$APP-$VERSION-$ARCH" | |
mv dist/helix-gpt dist/$OUTPUT | |
mv dist/helix-gpt.js "dist/$APP-$VERSION.js" | |
- name: Tag release | |
run: | | |
git config --global user.name "Leon" | |
git config --global user.email "[email protected]" | |
sed -e 's/<release-version>/${{ github.event.inputs.tag }}/g' assets/template.md > README.md | |
git add README.md | |
git commit -m 'release: version ${{ github.event.inputs.tag }}' | |
git push origin master | |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
messages=$(git log $latest_tag..HEAD --pretty=format:"%h - %s") | |
git tag -m "$messages" -a ${{ github.event.inputs.tag }} | |
git push origin ${{ github.event.inputs.tag }} | |
- uses: actions/upload-artifact@v4 | |
if: vars.RUNNER != 'act' | |
with: | |
name: bins | |
path: dist | |
publish: | |
name: Publish | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Build archive | |
shell: bash | |
run: | | |
set -ex | |
source="$(pwd)" | |
cd "$(mktemp -d)" | |
mv $source/bins* . | |
mkdir dist | |
for bin in bins/*; do | |
filename=$(basename ${bin}) | |
if [[ "$bin" == *.js ]]; then | |
mv $bin dist/$filename | |
continue | |
fi | |
tar -C `dirname $bin` -czvf dist/$filename.tar.gz --transform 's,^.*/,,g' `basename $bin` | |
done | |
tar -czvf dist/helix-gpt-${{ github.event.inputs.tag }}-source.tar.gz -C $source . | |
mv dist $source/ | |
- name: Upload binaries to release | |
if: vars.RUNNER != 'act' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GH_TOKEN }} | |
file: dist/* | |
file_glob: true | |
tag: ${{ github.event.inputs.tag }} | |
release_name: "${{ github.event.inputs.tag }}" | |
overwrite: true | |
- name: Upload binaries as artifact | |
if: vars.RUNNER != 'act' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release | |
path: dist/* |