-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (53 loc) · 1.77 KB
/
publish.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
name: Release
on:
workflow_dispatch:
inputs:
dry-run:
description: "Dry run"
required: true
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 200
fetch-tags: true
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Enable Corepack
run: corepack enable
- name: Install Dependencies
run: yarn install --immutable
- name: New version (dry run)
if: github.ref == 'refs/heads/main' && inputs.dry-run
run: yarn yarn-version version --dry-run
- name: Configure Git user
if: github.ref == 'refs/heads/main' && !inputs.dry-run
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: New version
if: github.ref == 'refs/heads/main' && !inputs.dry-run
run: |
yarn yarn-version version --create-release=github -m 'chore: release %v [skip ci]'
env:
HUSKY: 0
GH_TOKEN: ${{ secrets.GH_TOKEN }}
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Publish to npm
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "Missing env variable NODE_AUTH_TOKEN"
exit 1
fi
echo >> ./.yarnrc.yml
echo "npmAuthToken: $NODE_AUTH_TOKEN" >> ./.yarnrc.yml
yarn workspaces foreach --all --parallel --no-private npm publish --tolerate-republish
if: github.ref == 'refs/heads/main' && !inputs.dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}