-
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.79 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 src/index.ts --compile --target=bun-windows-x64 --outfile bts --define VERSION=\"${{ env.FULL_VERSION }}\"
# 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