-
Notifications
You must be signed in to change notification settings - Fork 10
82 lines (79 loc) · 2.92 KB
/
release-main.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
name: Release Versions or Publish NPM
on:
push:
branches:
- main
# This is for .npmrc. Nx automatically creates an .npmrc before changesets runs
# and creates one itself, so we need to explicitly have one.
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
concurrency: commits-to-main
jobs:
release-main:
runs-on: ubuntu-latest
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
with:
node_version: 19.5.0
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Workspace lint
shell: bash
run: npx nx workspace-lint
- name: Lint
shell: bash
run: npx nx run-many --target=lint --all --parallel=5
- name: Test
shell: bash
run: npx nx run-many --target=test --all --parallel=5
- name: Build for publishing
shell: bash
run: npx nx run-many --target=build --configuration=production --all --parallel=5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
- name: Containers
shell: bash
run: npx nx run-many --target=container --configuration=production -all --parallel=5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
- name: Containers zen
shell: bash
run: npx nx run-many --target=container --configuration=production-testnet-zen -all --parallel=5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
# If there are changesets, then we are in PR prep mode and will
# update the release pull request. Note that if there are no changesets
# this step will be skipped because no publish script is specified.
- name: Update release pull request
id: changesets
uses: changesets/action@v1
with:
commit: 'chore: release packages'
version: npm run version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Replace src code with dists for publishing
if: steps.changesets.outputs.hasChangesets == 'false'
run: ./scripts/replace-src-with-dists-for-publishing.sh
# If no changesets were detected in the PR prep step then we are in
# release/publish mode. Check for and publish any new versions to NPM.
- name: Publish to NPM and create GitHub releases
if: steps.changesets.outputs.hasChangesets == 'false'
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}