-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (74 loc) · 2.14 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
name: Release
on:
push:
branches:
- develop
- main
env:
CACHE_KEY: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
CACHE_PATH: ./*
jobs:
release:
runs-on: ubuntu-latest
name: release:${{ github.ref_name == 'main' && 'main' || 'develop' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.10.0
- name: Setup node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 20.9.0
- name: Cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Build
run: |
pnpm install --frozen-lockfile --prefer-offline
pnpm run build
- name: Setup npm registry
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> "$HOME/.npmrc"
- name: Canary release
if: github.ref_name == 'develop'
run: |
pnpm changeset version --snapshot next
pnpm changeset publish --tag next --no-git-tag
- name: Stable release
if: github.ref_name == 'main'
run: |
pnpm changeset version
pnpm changeset publish --no-git-tag
pnpm install
- name: Commit changes
if: github.ref_name == 'main'
run: |
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -m "chore: release"
- name: Create git tags
if: github.ref_name == 'main'
run: |
pnpm changeset tag
- name: Push changes
if: github.ref_name == 'main'
run: |
git push origin main
git push origin main --tags
- name: Merge to develop
if: github.ref_name == 'main'
run: |
git checkout main
git pull
git checkout develop
git pull
git rebase main
git push