@@ -2,20 +2,34 @@ name: Release
22
33on :
44 push :
5- tags :
6- - ' v*'
5+ # TEMPORARY FOR TESTING ON FORK ONLY.
6+ # tags:
7+ # - 'v*'
8+ pull_request :
9+ branches :
10+ - main
11+ workflow_dispatch :
12+ inputs :
13+ dry-run :
14+ description : Validate build and npm publish without uploading
15+ type : boolean
16+ default : true
717
818permissions :
919 contents : write
20+ id-token : write
21+
22+ env :
23+ DRY_RUN : ${{ !(startsWith(github.ref, 'refs/tags/') || inputs.dry-run == 'false') }}
1024
1125jobs :
1226 build :
1327 runs-on : ubuntu-latest
1428
1529 steps :
16- - uses : actions/checkout@v4
30+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1731
18- - uses : oven-sh/setup-bun@v2
32+ - uses : oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
1933 with :
2034 bun-version : latest
2135
5064 sha256sum plannotator-win32-x64.exe > plannotator-win32-x64.exe.sha256
5165
5266 - name : Upload artifacts
53- uses : actions/upload-artifact@v4
67+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
5468 with :
5569 name : binaries
5670 path : |
@@ -64,10 +78,10 @@ jobs:
6478 contents : write
6579
6680 steps :
67- - uses : actions/checkout@v4
81+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6882
6983 - name : Download artifacts
70- uses : actions/download-artifact@v4
84+ uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
7185 with :
7286 name : binaries
7387 path : artifacts
7690 run : ls -la artifacts/
7791
7892 - name : Create GitHub Release
79- uses : softprops/action-gh-release@v2
93+ if : startsWith(github.ref, 'refs/tags/')
94+ uses : softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
8095 with :
8196 files : artifacts/*
8297 generate_release_notes : true
8398 draft : false
8499 prerelease : ${{ contains(github.ref, '-') }}
100+
101+ npm-publish :
102+ needs : build
103+ runs-on : ubuntu-latest
104+ permissions :
105+ contents : read
106+ id-token : write
107+ steps :
108+ - name : Set publish flags
109+ run : |
110+ if [[ "$DRY_RUN" == "true" ]]; then
111+ echo "PUBLISH_FLAGS=--dry-run" >> "$GITHUB_ENV"
112+ fi
113+
114+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
115+
116+ - uses : oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
117+ with :
118+ bun-version : latest
119+
120+ - name : Install dependencies
121+ run : bun install
122+
123+ - name : Build packages
124+ run : |
125+ bun run build:review
126+ bun run build:hook
127+ bun run build:opencode
128+ bun run build:pi
129+
130+ - name : Publish @plannotator/opencode
131+ run : bun publish --access public --provenance $PUBLISH_FLAGS
132+ working-directory : apps/opencode-plugin
133+ env :
134+ NPM_CONFIG_TOKEN : ${{ secrets.NPM_TOKEN }}
135+
136+ - name : Publish @plannotator/pi-extension
137+ run : bun publish --access public --provenance $PUBLISH_FLAGS
138+ working-directory : apps/pi-extension
139+ env :
140+ NPM_CONFIG_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments