-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (58 loc) · 2.63 KB
/
prerelease.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
name: Prerelease
on:
push:
branches:
- "development"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
prerelease:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"
cache-dependency-path: |
yarn.lock
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: yarn test --cache-dir=.turbo
- name: Build
run: yarn build --cache-dir=.turbo
- name: Check for pre.json file existence
id: check_files
uses: andstor/file-existence-action@v3.0.0
with:
files: ".changeset/pre.json"
- name: Enter prerelease mode (beta by default)
# If .changeset/pre.json does not exist and we did not recently exit
# prerelease mode, enter prerelease mode with tag beta
if: steps.check_files.outputs.files_exists == 'false' && !contains(github.event.head_commit.message, 'Exit prerelease')
run: yarn changeset pre enter beta
- name: Create prerelease PR
uses: changesets/action@v1
with:
version: yarn changeset version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm + GitHub
id: changesets
# Only run publish if we're still in pre mode and the last commit was
# via an automatically created Version Packages PR
if: steps.check_files.outputs.files_exists == 'true' && contains(github.event.head_commit.message, 'changeset-release/development')
uses: changesets/action@v1
with:
version: echo "This step should never version"
publish: yarn changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Tag release with beta on npm
if: steps.changesets.outputs.published == 'true' && contains(fromJSON(steps.changesets.outputs.publishedPackages).*.name, '@whereby.com/browser-sdk')
run: npm dist-tag add @whereby.com/browser-sdk@${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }} beta