-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (82 loc) · 2.47 KB
/
release.yml
File metadata and controls
99 lines (82 loc) · 2.47 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Release
on:
workflow_dispatch:
inputs:
release_as:
description: Release type override (major|minor|patch)
required: false
type: choice
options:
- major
- minor
- patch
prerelease:
description: Prerelease channel (alpha|beta|rc)
required: false
type: choice
options:
- alpha
- beta
- rc
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-22.04
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
steps:
- name: Using branch ${{ github.ref }} for repository ${{ github.repository }}.
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Run tests before release
uses: ./.github/actions/run-tests
with:
node-version: 22.x
test-command: yarn test
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Run release
env:
HUSKY: "0"
RELEASE_AS: ${{ github.event.inputs.release_as || '' }}
PRERELEASE: ${{ github.event.inputs.prerelease || '' }}
run: |
ARGS=()
if [ -n "$RELEASE_AS" ]; then
ARGS+=(--release-as "$RELEASE_AS")
fi
if [ -n "$PRERELEASE" ]; then
ARGS+=(--prerelease "$PRERELEASE")
fi
yarn release "${ARGS[@]}"
- name: Build packages for publish
run: |
yarn build
- name: Publish packages
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PRERELEASE: ${{ github.event.inputs.prerelease || '' }}
run: |
if [ -z "$YARN_NPM_AUTH_TOKEN" ]; then
echo "NPM_TOKEN is required"
exit 1
fi
PUBLISH_ARGS=(--access public --tolerate-republish)
if [ -n "$PRERELEASE" ]; then
PUBLISH_ARGS+=(--tag "$PRERELEASE")
fi
yarn workspace @modulify/conventional-git npm publish "${PUBLISH_ARGS[@]}"
yarn workspace @modulify/conventional-bump npm publish "${PUBLISH_ARGS[@]}"
yarn workspace @modulify/conventional-changelog npm publish "${PUBLISH_ARGS[@]}"
- name: Push release commit and tags
run: |
git push --follow-tags origin "${GITHUB_REF_NAME}"