-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (82 loc) · 3.19 KB
/
release.yaml
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
name: Release
on:
push:
branches:
- main # This makes the workflow only runs by push to branch, not pushed git tag
paths-ignore:
- '.devbots/**'
- '.husky/**'
- '.vscode/**'
- .editorconfig
- commitlint.config.js
- license
- docs/urls.json
pull_request:
paths-ignore:
- '.devbots/**'
- '.husky/**'
- '.vscode/**'
- .editorconfig
- commitlint.config.js
- license
- docs/urls.json
# for `concurrency`, release should be an independent workflow. (e.g. from test, lint, etc)
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 0 indicates all history for all branches and tags.
fetch-depth: 0 # For changeset
- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
version: 8.10.2
run_install: false # For cache
- name: Read .nvmrc
id: nvmrc
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
# pnpm should be installed before the setup-node action. REF: https://github.com/actions/setup-node/issues/530
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvmrc.outputs.version }}
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Create Release PR or Publish
uses: changesets/action@v1
id: changesets
with:
commit: 'chore: release'
title: 'chore: release'
version: pnpm changeset version
# Why `pnpm -r publish` instead of `changeset publish`? => For topological publish - REF: https://github.com/changesets/changesets/issues/238
# Why `rm packages/docs/package.json`? => Workaround of REF: https://github.com/changesets/changesets/issues/916
publish: pnpm run changeset:publish
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HUSKY: 0 # For changesets/action to commit, let's ignore husky
# - name: Add deployed docs url
# # Vercel GitHub bot automatically deploy docs pushed to production branch (`main`), regardless of GitHub Actions.
# # This step finds out the deployed docs "Preview URL".
# # Note that Vercel's "Preview URL" is static and permanent unless deleted manually.
# if: steps.changesets.outputs.published == 'true'
# run: pnpm --filter '@haetae/docs' run add-url
# env:
# VERCEL_ACCESS_TOKEN: ${{ secrets.VERCEL_ACCESS_TOKEN }}
# VERCEL_DEPLOYMENT_NAME: haetae
# - uses: stefanzweifel/git-auto-commit-action@v4
# if: steps.changesets.outputs.published == 'true'
# with:
# commit_message: 'docs: add url'
# token: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }} # For Protected branch. REF: https://github.com/stefanzweifel/git-auto-commit-action#push-to-protected-branches
# env:
# HUSKY: 0 # To commit, let's ignore husky