@@ -3,9 +3,14 @@ name: Release
33on :
44 push :
55 branches :
6- - develop
76 - main
87 workflow_dispatch :
8+ inputs :
9+ stable :
10+ description : ' Release stable version'
11+ required : false
12+ default : false
13+ type : boolean
914
1015env :
1116 CACHE_KEY : ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
1621 permissions :
1722 contents : write
1823 runs-on : ubuntu-latest
19- name : release:${{ github.ref_name == 'main' && 'main ' || 'develop ' }}
24+ name : release:${{ inputs.stable == true && 'stable ' || 'snapshot ' }}
2025 steps :
2126 - name : Checkout
2227 uses : actions/checkout@v4
@@ -30,38 +35,29 @@ jobs:
3035 - name : Setup npm registry
3136 run : echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> "$HOME/.npmrc"
3237 - name : Snapshot release
33- if : github.ref_name == 'develop'
38+ if : inputs.stable == false
3439 run : |
3540 pnpm changeset version --snapshot next
3641 pnpm changeset publish --tag next --no-git-tag
3742 - name : Stable release
38- if : github.ref_name == 'main'
43+ if : inputs.stable == true
3944 run : |
4045 pnpm changeset version
4146 pnpm changeset publish --no-git-tag
4247 pnpm install
4348 - name : Commit changes
44- if : github.ref_name == 'main'
49+ if : inputs.stable == true
4550 run : |
4651 git config user.name "GitHub Actions"
4752 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
4853 git add .
4954 git diff-index --quiet HEAD || git commit -m "chore: release [skip ci]"
5055 - name : Create git tags
51- if : github.ref_name == 'main'
56+ if : inputs.stable == true
5257 run : |
5358 pnpm changeset tag
5459 - name : Push changes
55- if : github.ref_name == 'main'
60+ if : inputs.stable == true
5661 run : |
5762 git push origin main
5863 git push origin main --tags
59- - name : Rebase develop onto main
60- if : github.ref_name == 'main'
61- run : |
62- git checkout main
63- git pull
64- git checkout develop
65- git pull
66- git rebase main
67- git push
0 commit comments