generated from NaverPayDev/ts-monorepo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (95 loc) · 4.07 KB
/
release.yml
File metadata and controls
107 lines (95 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Publish Package
on:
push:
branches:
- main
issue_comment:
types:
- created
permissions:
id-token: write
contents: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
get-branch:
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')
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.get_branch.outputs.branch }}
steps:
- name: Get PR branch name
id: get_branch
run: |
PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }})
branch=$(echo "$PR" | jq -r '.head.ref')
echo "branch=$branch" >> "$GITHUB_OUTPUT"
release:
name: Release
runs-on: ubuntu-latest
needs: [get-branch]
if: |
always() &&
(github.event_name == 'push' ||
(github.event_name == 'issue_comment' && needs.get-branch.result == 'success'))
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ needs.get-branch.outputs.branch || github.ref }}
token: ${{ secrets.ACTION_TOKEN }}
fetch-depth: 0
- uses: pnpm/action-setup@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Check and upgrade npm
run: |
echo "Current npm version:"
npm --version
npm install -g npm@latest
echo "Upgraded npm version:"
npm --version
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Publish - Release
if: github.event_name == 'push'
id: changesets
uses: NaverPayDev/changeset-actions/publish@main
with:
github_token: ${{ secrets.ACTION_TOKEN }}
git_username: npayfebot
git_email: npay.fe.bot@navercorp.com
publish_script: pnpm release
pr_title: '🚀 version changed packages'
commit_message: '📦 bump changed packages version'
create_github_release_tag: true
formatting_script: pnpm run markdownlint:fix
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
- name: Publish - Canary
if: github.event_name == 'issue_comment' && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish')
uses: NaverPayDev/changeset-actions/canary-publish@main
with:
github_token: ${{ secrets.ACTION_TOKEN }}
npm_tag: canary
publish_script: pnpm run release:canary
packages_dir: packages
excludes: '.turbo,.github'
version_template: '{VERSION}-canary.{DATE}-{COMMITID7}'
- name: Publish - RC
if: github.event_name == 'issue_comment' && (github.event.comment.body == 'rc-publish' || github.event.comment.body == '/rc-publish')
uses: NaverPayDev/changeset-actions/canary-publish@main
with:
github_token: ${{ secrets.ACTION_TOKEN }}
npm_tag: rc
publish_script: pnpm run release:canary
packages_dir: packages
excludes: '.turbo,.github'
version_template: '{VERSION}-rc.{DATE}-{COMMITID7}'
create_release: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}