Skip to content

Commit 93a5a96

Browse files
Merge pull request #85 from NaverPayDev/feature/changesets
✨ Add GitHub Actions workflows for Canary and RC releases
2 parents 42eb480 + b93d633 commit 93a5a96

3 files changed

Lines changed: 99 additions & 11 deletions

File tree

.github/workflows/canary.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Adjust according to your needs
2+
name: Release Canary
3+
4+
on:
5+
issue_comment:
6+
types:
7+
- created
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
canary:
13+
if: ${{ github.event.issue.pull_request && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish')}}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Get PR branch name
17+
id: get_branch
18+
run: |
19+
PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }})
20+
echo "::set-output name=branch::$(echo $PR | jq -r '.head.ref')"
21+
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ steps.get_branch.outputs.branch }}
25+
- uses: pnpm/action-setup@v4
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: '22'
29+
cache: 'pnpm'
30+
31+
- name: Install Dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: Canary Publish
35+
uses: NaverPayDev/changeset-actions/canary-publish@main
36+
with:
37+
github_token: ${{ secrets.ACTION_TOKEN }} # Add user PAT if necessary
38+
npm_tag: canary # Specify the npm tag to use for deployment
39+
npm_token: ${{ secrets.NPM_TOKEN }} # Provide the token required for npm publishing
40+
publish_script: pnpm run release:canary # Script to execute Canary deployment
41+
packages_dir: packages # Directory of packages to detect changes (default: packages,share)
42+
excludes: '.turbo,.github' # Files or directories to exclude from change detection
43+
version_template: '{VERSION}-canary.{DATE}-{COMMITID7}'

.github/workflows/rc.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Adjust according to your needs
2+
name: Release RC
3+
4+
on:
5+
issue_comment:
6+
types:
7+
- created
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
permissions:
12+
contents: write # to create release
13+
14+
jobs:
15+
canary:
16+
if: ${{ github.event.issue.pull_request && (github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')}}
17+
runs-on: ubuntu-latest
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
steps:
21+
- name: Get PR branch name
22+
id: get_branch
23+
run: |
24+
PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }})
25+
echo "::set-output name=branch::$(echo $PR | jq -r '.head.ref')"
26+
27+
- uses: actions/checkout@v4
28+
with:
29+
ref: ${{ steps.get_branch.outputs.branch }}
30+
fetch-depth: 0
31+
- uses: pnpm/action-setup@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: '22'
35+
cache: 'pnpm'
36+
37+
- name: Install Dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: RC Publish
41+
uses: NaverPayDev/changeset-actions/canary-publish@main
42+
with:
43+
github_token: ${{ secrets.ACTION_TOKEN }} # Add user PAT if necessary
44+
npm_tag: rc # Specify the npm tag to use for deployment
45+
npm_token: ${{ secrets.NPM_TOKEN }} # Provide the token required for npm publishing
46+
publish_script: pnpm run release:canary # Script to execute Canary deployment
47+
packages_dir: packages # Directory of packages to detect changes (default: packages,share)
48+
excludes: '.turbo,.github' # Files or directories to exclude from change detection
49+
version_template: '{VERSION}-rc.{DATE}-{COMMITID7}'
50+
create_release: true

.github/workflows/release.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,27 @@ jobs:
1818
token: ${{ secrets.ACTION_TOKEN }}
1919
fetch-depth: 0
2020

21+
- uses: pnpm/action-setup@v4
2122
- name: Use Node.js
2223
uses: actions/setup-node@v4
2324
with:
24-
node-version: '22.x'
25-
26-
- name: Enable corepack
27-
run: corepack enable
28-
29-
- name: setup pnpm and install dependencies
30-
uses: pnpm/action-setup@v3
31-
with:
32-
run_install: |
33-
recursive: false
25+
node-version: '22'
26+
cache: 'pnpm'
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
3429

3530
- name: Create Release Pull Request
3631
id: changesets
3732
uses: NaverPayDev/changeset-actions/publish@main
3833
with:
3934
github_token: ${{ secrets.ACTION_TOKEN }}
40-
npm_token: ${{ secrets.NPM_TOKEN }}
4135
git_username: npayfebot
4236
git_email: npay.fe.bot@navercorp.com
4337
publish_script: pnpm release
4438
pr_title: '🚀 version changed packages'
4539
commit_message: '📦 bump changed packages version'
4640
create_github_release_tag: true
4741
formatting_script: pnpm run markdownlint:fix
42+
npm_token: ${{ secrets.NPM_TOKEN }}
4843
env:
4944
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}

0 commit comments

Comments
 (0)