File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,54 +2,19 @@ name: Release
22
33on :
44 push :
5- branches :
6- - main
7- paths :
8- - ' package.json'
5+ tags :
6+ - ' v*'
97
108permissions :
119 contents : write
1210
1311jobs :
14- check-version :
15- runs-on : ubuntu-latest
16- outputs :
17- version : ${{ steps.check.outputs.version }}
18- changed : ${{ steps.check.outputs.changed }}
19- steps :
20- - uses : actions/checkout@v6
21- with :
22- fetch-depth : 2
23-
24- - name : Check version change
25- id : check
26- run : |
27- CURRENT=$(jq -r .version package.json)
28- PREVIOUS=$(git show HEAD~1:package.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
29- echo "version=${CURRENT}" >> "$GITHUB_OUTPUT"
30- if [ "$CURRENT" != "$PREVIOUS" ] && [ -n "$CURRENT" ]; then
31- echo "changed=true" >> "$GITHUB_OUTPUT"
32- else
33- echo "changed=false" >> "$GITHUB_OUTPUT"
34- fi
35-
36- - name : Create tag
37- if : steps.check.outputs.changed == 'true'
38- run : |
39- git tag "v${{ steps.check.outputs.version }}"
40- git push origin "v${{ steps.check.outputs.version }}"
41-
4212 release :
43- needs : check-version
44- if : needs.check-version.outputs.changed == 'true'
4513 runs-on : ubuntu-latest
4614 env :
4715 GOTOOLCHAIN : auto
48- GITHUB_REF : refs/tags/v${{ needs.check-version.outputs.version }}
4916 steps :
5017 - uses : actions/checkout@v6
51- with :
52- ref : v${{ needs.check-version.outputs.version }}
5318
5419 - uses : pnpm/action-setup@v4
5520
You can’t perform that action at this time.
0 commit comments