-
Notifications
You must be signed in to change notification settings - Fork 244
49 lines (42 loc) · 1.71 KB
/
preview-release.yml
File metadata and controls
49 lines (42 loc) · 1.71 KB
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
name: Preview Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
# Run the job if manually triggered or if the commit message includes a commit type of fix or feat or breaking change
if: contains(github.event.head_commit.message, 'fix:') || contains(github.event.head_commit.message, 'fix(') || contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'feat(') || contains(github.event.head_commit.message, '!:')
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job
- name: Set Git identity
run: |
git config --global user.email "support+actions@github.com"
git config --global user.name "github-actions-bot"
- name: Update package versions for preview snapshot release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn changeset version --snapshot preview-${GITHUB_SHA::8}
node scripts/generate-versions.js
yarn install --refresh-lockfile
- name: Configure NPM for changeset publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish preview snapshot release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn build
git add .
git commit -am "chore: publish preview snapshot version"
yarn changeset publish --no-git-tag --tag preview
git reset --hard HEAD^