-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (108 loc) · 3.55 KB
/
publish.yml
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
108
109
110
111
112
113
name: Build and publish
on:
push:
branches: [main, beta, next]
release:
types:
- published
jobs:
yarn_build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache node modules
uses: actions/cache@v3
id: cache
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
- name: Build
run: yarn build
semantic-release:
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/next' }}
name: Create a semantic release
runs-on: ubuntu-latest
needs:
- yarn_build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache node modules
uses: actions/cache@v3
id: cache
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.BUMP_GIT_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.BUMP_GIT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.BUMP_GIT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.BUMP_GIT_EMAIL }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
sync_main_to_beta:
if: ${{ github.ref == 'refs/heads/main' }}
name: Sync branch `main` to `beta` (fast-forward enabled)
runs-on: ubuntu-latest
needs:
- semantic-release
steps:
- name: Keep `beta` up to date with `main` (fast-forward enabled)
uses: johannes-huther/sync-branch@v2
with:
git_committer_name: ${{ secrets.BUMP_GIT_NAME }}
git_committer_email: ${{ secrets.BUMP_GIT_EMAIL }}
github_token: ${{ secrets.GH_TOKEN }}
sync_beta_to_next:
if: ${{ github.ref == 'refs/heads/beta' }}
name: Sync branch `beta` to `next` (fast-forward enabled)
runs-on: ubuntu-latest
needs:
- semantic-release
steps:
- name: Keep `next` up to date with `beta` (fast-forward enabled)
uses: johannes-huther/sync-branch@v2
with:
target: "next"
git_committer_name: ${{ secrets.BUMP_GIT_NAME }}
git_committer_email: ${{ secrets.BUMP_GIT_EMAIL }}
github_token: ${{ secrets.GH_TOKEN }}
sync_beta_to_updates:
if: ${{ github.ref == 'refs/heads/beta' }}
name: Sync branch `beta` to `updates` (fast-forward enabled)
runs-on: ubuntu-latest
needs:
- semantic-release
steps:
- name: Keep `updates` up to date with `beta` (fast-forward enabled)
uses: johannes-huther/sync-branch@v2
with:
target: "updates"
git_committer_name: ${{ secrets.BUMP_GIT_NAME }}
git_committer_email: ${{ secrets.BUMP_GIT_EMAIL }}
github_token: ${{ secrets.GH_TOKEN }}