-
-
Notifications
You must be signed in to change notification settings - Fork 393
82 lines (71 loc) · 2.32 KB
/
release.yml
File metadata and controls
82 lines (71 loc) · 2.32 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
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
on:
workflow_dispatch:
inputs:
version:
type: choice
description: 'Release Version'
required: true
default: 'next'
options:
- latest
- next
branch:
description: 'Release Branch (confirm release branch)'
required: true
default: 'main'
permissions:
id-token: write
jobs:
release:
name: Release
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
runs-on: ubuntu-latest
environment: npm
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 25
ref: ${{ github.event.inputs.branch }}
- name: Cache Tool Downloads
uses: actions/cache@v5
with:
path: ~/.cache
key: ${{ runner.os }}-toolcache-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-toolcache-
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
# Update npm to the latest version to enable OIDC
- name: Update npm
run: |
npm install -g npm@latest
npm --version
- name: Install deps
run: pnpm install --frozen-lockfile
- name: Generate preview version
if: github.event.inputs.version == 'next'
run: |
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9-]/-/g' | tr '[:upper:]' '[:lower:]')
npx changeset version --snapshot "$SAFE_BRANCH"
- name: Build and test Packages
run: |
git fetch origin main
npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
npx nx run-many --targets=build --projects=tag:type:metro
ls -l packages/*/dist packages/*/package.json
- name: Publish latest version
if: github.event.inputs.version == 'latest'
run: |
pnpm -r publish --tag ${{ github.event.inputs.version }} --publish-branch ${{ github.event.inputs.branch }}
- name: Publish preview version
if: github.event.inputs.version == 'next'
run: |
pnpm -r publish --tag next --no-git-checks