1- name : release packages
1+ name : Publish Package
22
33on :
44 push :
55 branches :
66 - main
7+ issue_comment :
8+ types :
9+ - created
710
811permissions :
912 id-token : write
@@ -12,13 +15,32 @@ permissions:
1215concurrency : ${{ github.workflow }}-${{ github.ref }}
1316
1417jobs :
18+ get-branch :
19+ if : github.event_name == 'issue_comment' && github.event.issue.pull_request && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish' || github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')
20+ runs-on : ubuntu-latest
21+ outputs :
22+ branch : ${{ steps.get_branch.outputs.branch }}
23+ steps :
24+ - name : Get PR branch name
25+ id : get_branch
26+ run : |
27+ PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }})
28+ branch=$(echo "$PR" | jq -r '.head.ref')
29+ echo "branch=$branch" >> "$GITHUB_OUTPUT"
30+
1531 release :
1632 name : Release
1733 runs-on : ubuntu-latest
34+ needs : [get-branch]
35+ if : |
36+ always() &&
37+ (github.event_name == 'push' ||
38+ (github.event_name == 'issue_comment' && needs.get-branch.result == 'success'))
1839 steps :
1940 - name : Checkout Repo
20- uses : actions/checkout@v3
41+ uses : actions/checkout@v4
2142 with :
43+ ref : ${{ needs.get-branch.outputs.branch || github.ref }}
2244 token : ${{ secrets.ACTION_TOKEN }}
2345 fetch-depth : 0
2446
4365 - name : Build
4466 run : pnpm build
4567
46- - name : Create Release Pull Request
68+ - name : Publish - Release
69+ if : github.event_name == 'push'
4770 id : changesets
4871 uses : NaverPayDev/changeset-actions/publish@main
4972 with :
5780 formatting_script : pnpm run markdownlint:fix
5881 env :
5982 GITHUB_TOKEN : ${{ secrets.ACTION_TOKEN }}
83+
84+ - name : Publish - Canary
85+ if : github.event_name == 'issue_comment' && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish')
86+ uses : NaverPayDev/changeset-actions/canary-publish@main
87+ with :
88+ github_token : ${{ secrets.ACTION_TOKEN }}
89+ npm_tag : canary
90+ publish_script : pnpm run release:canary
91+ packages_dir : packages
92+ excludes : ' .turbo,.github'
93+ version_template : ' {VERSION}-canary.{DATE}-{COMMITID7}'
94+
95+ - name : Publish - RC
96+ if : github.event_name == 'issue_comment' && (github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')
97+ uses : NaverPayDev/changeset-actions/canary-publish@main
98+ with :
99+ github_token : ${{ secrets.ACTION_TOKEN }}
100+ npm_tag : rc
101+ publish_script : pnpm run release:canary
102+ packages_dir : packages
103+ excludes : ' .turbo,.github'
104+ version_template : ' {VERSION}-rc.{DATE}-{COMMITID7}'
105+ create_release : true
106+ env :
107+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments