-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (98 loc) · 2.8 KB
/
release.yml
File metadata and controls
118 lines (98 loc) · 2.8 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Release
on:
workflow_dispatch:
inputs:
release:
description: Release type
required: true
default: auto
type: choice
options:
- auto
- patch
- minor
- major
prerelease:
description: Prerelease type
required: true
default: none
type: choice
options:
- none
- alpha
- beta
- rc
permissions:
contents: write
id-token: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 60
environment: npm
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Ensure stable release is running from main
if: ${{ inputs.prerelease == 'none' }}
shell: bash
run: |
if [ "$GITHUB_REF_NAME" != "main" ]; then
echo "Stable release is allowed only from main. Current ref: $GITHUB_REF_NAME"
exit 1
fi
- name: Setup Node.js for release
uses: ./.github/actions/setup-node
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
node-version: 24
cache: 'false'
- name: Configure git user
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Run eslint
run: yarn eslint
- name: Run release tests
uses: ./.github/actions/test
with:
upload-coverage: 'false'
- name: Run conventional release
env:
RELEASE_TYPE: ${{ inputs.release }}
PRERELEASE: ${{ inputs.prerelease }}
shell: bash
run: |
args=(--verbose --tags)
if [ "$RELEASE_TYPE" != "auto" ]; then
args+=(--release-as "$RELEASE_TYPE")
fi
if [ "$PRERELEASE" != "none" ]; then
args+=(--prerelease "$PRERELEASE")
fi
npx --yes --package @modulify/conventional-release@0.1.2 conventional-release "${args[@]}"
- name: Build package
run: yarn build
- name: Push release commit and tags
shell: bash
run: git push origin "HEAD:${GITHUB_REF_NAME}" --follow-tags
- name: Publish package to npm
shell: bash
run: |
version=$(node -p "require('./package.json').version")
tag=latest
if [[ "$version" == *-* ]]; then
tag="${version#*-}"
tag="${tag%%.*}"
fi
npm publish --access public --tag "$tag"