11name : Release
22
33on :
4- workflow_dispatch :
5- inputs :
6- npm_tag :
7- description : ' npm tag for publish'
8- required : true
9- default : ' latest'
10- type : choice
11- options :
12- - latest
13- - alpha
14- version :
15- description : ' Override version (leave empty to auto-compute). Use when retrying a failed publish.'
16- required : false
17- default : ' '
18- type : string
4+ push :
5+ branches : [main]
6+ paths :
7+ - ' packages/cli/package.json'
198
209permissions : {}
2110
2211env :
2312 RELEASE_BUILD : ' true'
2413 DEBUG : ' napi:*'
25- NPM_TAG : ${{ inputs.npm_tag }}
2614
2715jobs :
28- prepare :
16+ check :
17+ if : github.repository == 'voidzero-dev/vite-plus'
18+ name : Check version
2919 runs-on : ubuntu-latest
3020 permissions :
3121 contents : read
3222 outputs :
23+ version_changed : ${{ steps.version.outputs.changed }}
3324 version : ${{ steps.version.outputs.version }}
3425 steps :
35- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36- with :
37- fetch-depth : 0
38- fetch-tags : true
39- persist-credentials : false
40- - uses : ./.github/actions/set-snapshot-version
41- if : ${{ inputs.version == '' }}
42- id : computed
43- with :
44- npm_tag : ${{ inputs.npm_tag }}
26+ - uses : taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
4527
46- - name : Set final version
28+ - uses : oxc-project/setup-node@ab97f03642370d79a7e96dd286bd02a1be40e0ba # v1.3.0
29+
30+ - name : Check version changes
31+ uses : EndBug/version-check@095362f3cd50f690c8fa0e6afeea81834bd8d320 # v3.0.0
4732 id : version
48- env :
49- INPUT_VERSION : ${{ inputs.version }}
50- COMPUTED_VERSION : ${{ steps.computed.outputs.version }}
51- run : echo "version=${INPUT_VERSION:-$COMPUTED_VERSION}" >> "$GITHUB_OUTPUT"
33+ with :
34+ static-checking : localIsNew
35+ file-url : https://unpkg.com/vite-plus@latest/package.json
36+ file-name : packages/cli/package.json
5237
5338 build-rust :
5439 name : Build bindings and binaries
55- needs : prepare
40+ needs : check
41+ if : needs.check.outputs.version_changed == 'true'
5642 permissions :
5743 contents : read
5844 uses : ./.github/workflows/reusable-release-build.yml
5945 with :
60- version : ${{ needs.prepare .outputs.version }}
46+ version : ${{ needs.check .outputs.version }}
6147 cache-key : release
6248
6349 request-approval :
6450 runs-on : ubuntu-latest
65- needs : [prepare, build-rust]
51+ needs : [check, build-rust]
52+ if : needs.check.outputs.version_changed == 'true'
6653 steps :
6754 - uses : tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 # v7.0.0
6855 with :
6956 webhook-url : ${{ secrets.DISCORD_RELEASES_WEBHOOK_URL }}
70- content : ' Requesting approval: ${{ github.server_url }}/${{ github.repository }}/actions/workflows/release.yml'
57+ content : ' Requesting approval for vite-plus v${{ needs.check.outputs.version }} : ${{ github.server_url }}/${{ github.repository }}/actions/workflows/release.yml'
7158
7259 Release :
7360 runs-on : ubuntu-latest
7461 environment : release
75- needs : [prepare, build-rust, request-approval]
62+ needs : [check, build-rust, request-approval]
63+ if : needs.check.outputs.version_changed == 'true'
7664 permissions :
7765 contents : write
7866 packages : write
7967 id-token : write # Required for OIDC
8068 env :
81- VERSION : ${{ needs.prepare .outputs.version }}
69+ VERSION : ${{ needs.check .outputs.version }}
8270 steps :
8371 - uses : taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
8472 - uses : ./.github/actions/clone
@@ -168,22 +156,17 @@ jobs:
168156
169157 - name : Publish
170158 run : |
171- pnpm publish --filter=./packages/core --tag "${NPM_TAG}" --access public --no-git-checks
172- pnpm publish --filter=./packages/test --tag "${NPM_TAG}" --access public --no-git-checks
173- pnpm publish --filter=./packages/cli --tag "${NPM_TAG}" --access public --no-git-checks
159+ pnpm publish --filter=./packages/core --tag latest --access public --no-git-checks
160+ pnpm publish --filter=./packages/test --tag latest --access public --no-git-checks
161+ pnpm publish --filter=./packages/cli --tag latest --access public --no-git-checks
174162
175163 - name : Create release body
176164 env :
177165 REPOSITORY : ${{ github.repository }}
178166 COMMIT_SHA : ${{ github.sha }}
179167 run : |
180- if [[ "${NPM_TAG}" == "latest" ]]; then
181- INSTALL_BASH="curl -fsSL https://vite.plus | bash"
182- INSTALL_PS1="irm https://vite.plus/ps1 | iex"
183- else
184- INSTALL_BASH="curl -fsSL https://vite.plus | VP_VERSION=${VERSION} bash"
185- INSTALL_PS1="\\\$env:VP_VERSION=\\\"${VERSION}\\\"; irm https://vite.plus/ps1 | iex"
186- fi
168+ INSTALL_BASH="curl -fsSL https://vite.plus | bash"
169+ INSTALL_PS1="irm https://vite.plus/ps1 | iex"
187170 cat > ./RELEASE_BODY.md <<EOF
188171 ## vite-plus v${VERSION}
189172
@@ -216,8 +199,8 @@ jobs:
216199 with :
217200 body_path : ./RELEASE_BODY.md
218201 draft : true
219- make_latest : ${{ inputs.npm_tag == 'latest' }}
220- prerelease : ${{ inputs.npm_tag == 'alpha' }}
202+ make_latest : true
203+ prerelease : false
221204 name : vite-plus v${{ env.VERSION }}
222205 tag_name : v${{ env.VERSION }}
223206 target_commitish : ${{ github.sha }}
@@ -230,7 +213,6 @@ jobs:
230213 run : gh release edit "v${VERSION}" --draft=false --repo "${{ github.repository }}"
231214
232215 - name : Send Discord notification
233- if : ${{ inputs.npm_tag == 'latest' }}
234216 uses : tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645 # v7.0.0
235217 with :
236218 webhook-url : ${{ secrets.DISCORD_RELEASES_WEBHOOK_URL }}
0 commit comments