-
Notifications
You must be signed in to change notification settings - Fork 193
73 lines (61 loc) · 2.1 KB
/
snapshot.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
name: Snapshot release
# Releases a snapshot release when new commits merge to main
# This ensures the release process is working as expected
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "docs/**"
# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm
jobs:
release-snapshot:
name: Publish snapshot release to npm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check for pre.json file existence
id: check_files
uses: andstor/[email protected]
with:
files: ".changeset/pre.json"
# Remove this once https://github.com/changesets/changesets/issues/1195 is addressed
- name: Temporarily exit pre-release mode to release a snapshot
if: steps.check_files.outputs.files_exists == 'true'
run: pnpm changeset pre exit
- name: Clean
shell: bash
run: pnpm turbo run clean --force --concurrency 10
# Build without cache to ensure we release with the most accurate output
- name: Build
shell: bash
run: pnpm turbo run build --force --concurrency 10
# The changesets action doesn't support releasing snapshots (yet),
# so doing it manually here
- name: Publish snapshots
run: |
pnpm changeset version --snapshot ${{ github.ref_name }}
pnpm changeset publish --tag ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
docker:
uses: ./.github/workflows/docker.yml
needs: release-snapshot
test-snapshot:
uses: ./.github/workflows/test-published-packages.yml
needs: release-snapshot
with:
tag-or-version: ${{ github.ref_name }}