Create Release #3
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: Create Release | |
on: | |
workflow_dispatch: # This makes it manual-launch only | |
jobs: | |
test-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install Dependencies | |
run: bun install | |
- name: Run Tests | |
run: bun test | |
- name: Set Version Number | |
id: version | |
run: | | |
BASE_VERSION=$(node -p "require('./package.json').version") | |
FULL_VERSION="${BASE_VERSION}.${GITHUB_RUN_NUMBER}" | |
echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_ENV | |
# Update package.json with new version | |
node -e "const pkg=require('./package.json'); pkg.version='$FULL_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2))" | |
- name: Build Executable | |
run: | | |
bun build index.ts --compile --target=bun-windows-x64 --outfile bts | |
# Windows builds automatically add .exe extension | |
chmod +x bts.exe | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.FULL_VERSION }} | |
release_name: Release v${{ env.FULL_VERSION }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bts.exe | |
asset_name: bts.exe | |
asset_content_type: application/octet-stream |