-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (47 loc) · 1.47 KB
/
pre-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
name: Configure Pre-release
on:
pull_request:
types:
- opened
branches:
- main
- beta
jobs:
configure:
name: Configure Pre-release
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Check if pre.json exists
id: pre-release-file
run: |
if [ -f ".changeset/pre.json" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Echo pre-release file exists
run: echo ${{ steps.pre-release-file.outputs.exists }}
- name: Install Changeset
run: npm install -g @changesets/cli
- name: Enter pre-release mode for Beta
if: ${{ github.base_ref == 'beta' && steps.pre-release-file.outputs.exists == 'false' }}
run: npx changeset pre enter beta
- name: Exit pre-release mode for Main
if: ${{ github.base_ref == 'main' && steps.pre-release-file.outputs.exists == 'true' }}
run: npx changeset pre exit
- name: Commit Changes to the Pull Request
uses: EndBug/add-and-commit@v9
with:
add: .changeset/pre.json
message: 'Configure pre-release mode'