blob: 71d59a1b831c1d0609ea0d3fc1f2f67e08ffd9d3 [file] [log] [blame]
Marc Kupietzd1531de2026-03-21 14:35:32 +01001name: Build and Release
2
3on:
4 push:
5 tags:
6 - 'v*'
7 workflow_dispatch:
8
9jobs:
10 test:
11 runs-on: ubuntu-latest
12 steps:
13 - uses: actions/checkout@v4
14 - uses: actions/setup-node@v4
15 with:
16 node-version: '22'
17 cache: 'npm'
18 - run: npm ci
19 - run: npm test
20
21 build:
22 needs: test
23 runs-on: ubuntu-latest
24 steps:
25 - uses: actions/checkout@v4
26 - uses: actions/setup-node@v4
27 with:
28 node-version: '22'
29 cache: 'npm'
30 - run: npm ci
31 - run: mkdir -p bin/linux bin/macos bin/win
32 - name: Build Linux executable
33 run: npm run pkg-linux
34 - name: Build macOS executable
35 run: npm run pkg-macos
36 - name: Build Windows executable
37 run: npm run pkg-win
38 - name: Upload Linux binary
39 uses: actions/upload-artifact@v4
40 with:
Marc Kupietz202a36d2026-04-12 14:58:13 +020041 name: cmc-tagger-linux-x64
42 path: bin/linux/cmc-tagger
Marc Kupietzd1531de2026-03-21 14:35:32 +010043 if-no-files-found: error
44 - name: Upload macOS binary
45 uses: actions/upload-artifact@v4
46 with:
Marc Kupietz202a36d2026-04-12 14:58:13 +020047 name: cmc-tagger-macos-x64
48 path: bin/macos/cmc-tagger
Marc Kupietzd1531de2026-03-21 14:35:32 +010049 if-no-files-found: error
50 - name: Upload Windows binary
51 uses: actions/upload-artifact@v4
52 with:
Marc Kupietz202a36d2026-04-12 14:58:13 +020053 name: cmc-tagger-win-x64
54 path: bin/win/cmc-tagger.exe
Marc Kupietzd1531de2026-03-21 14:35:32 +010055 if-no-files-found: error
56 - name: Create GitHub Release
57 if: startsWith(github.ref, 'refs/tags/')
58 uses: softprops/action-gh-release@v2
59 with:
60 files: |
Marc Kupietz202a36d2026-04-12 14:58:13 +020061 bin/linux/cmc-tagger
62 bin/macos/cmc-tagger
63 bin/win/cmc-tagger.exe
Marc Kupietzd1531de2026-03-21 14:35:32 +010064 generate_release_notes: true
Marc Kupietz36a6e802026-07-23 11:05:23 +020065
66 publish-npm:
67 needs: test
68 runs-on: ubuntu-latest
69 if: startsWith(github.ref, 'refs/tags/')
70 permissions:
71 id-token: write # required for npm trusted publishing (OIDC)
72 contents: read
73 steps:
74 - uses: actions/checkout@v4
75 - uses: actions/setup-node@v4
76 with:
77 node-version: '22'
78 registry-url: 'https://registry.npmjs.org'
79 - run: npm install -g npm@latest # OIDC/trusted publishing needs npm >= 11.5.1
80 - run: npm ci
81 - run: npm publish # no token: authenticates via OIDC, provenance is automatic