-
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (106 loc) · 3.44 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (106 loc) · 3.44 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
119
120
121
122
123
124
125
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump to apply
required: true
type: choice
options:
- Select a version bump
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor
prerelease_id:
description: 'Prerelease identifier, such as alpha or beta'
required: false
type: string
default: alpha
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
id-token: write
packages: write
jobs:
validate:
name: Validate Inputs
runs-on: ubuntu-latest
outputs:
release_arguments: ${{ steps.build_release_arguments.outputs.arguments }}
steps:
- name: Validate Inputs
id: validate_inputs
run: |
BUMP="${{ inputs.bump }}"
PRERELEASE_ID="${{ inputs.prerelease_id }}"
# Stable releases use a standard semantic version bump.
if [[ "$BUMP" =~ ^(patch|minor|major)$ ]]; then
echo "Valid stable release bump: $BUMP"
exit 0
fi
# Prerelease releases require both a prerelease bump
# and an identifier such as alpha, beta, or rc.
if [[ "$BUMP" =~ ^(prerelease|prepatch|preminor|premajor)$ ]]; then
if [[ -z "$PRERELEASE_ID" ]]; then
echo "::error::A prerelease identifier is required for prerelease releases."
exit 1
fi
echo "Valid prerelease bump: $BUMP"
echo "Prerelease identifier: $PRERELEASE_ID"
exit 0
fi
echo "::error::Invalid release bump type: $BUMP"
exit 1
- name: Build Release Arguments
id: build_release_arguments
run: |
BUMP="${{ inputs.bump }}"
PRERELEASE_ID="${{ inputs.prerelease_id }}"
# Stable releases only need the version bump.
if [[ "$BUMP" =~ ^(patch|minor|major)$ ]]; then
RELEASE_ARGUMENTS="--$BUMP"
else
# Prerelease releases also specify the prerelease identifier
# and publish under the matching npm distribution tag.
RELEASE_ARGUMENTS="--$BUMP --preid $PRERELEASE_ID --tag $PRERELEASE_ID"
fi
echo "arguments=$RELEASE_ARGUMENTS" >> "$GITHUB_OUTPUT"
echo "Release arguments: $RELEASE_ARGUMENTS"
release:
name: Release (${{ inputs.bump }})
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout Repository
uses: actions/checkout@v7.0.1
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Setup pnpm
uses: pnpm/action-setup@v6.0.8
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Packages
run: pnpm build
- name: Configure Git
run: |
git config --global user.name "favorodera"
git config --global user.email "favorodera@gmail.com"
- name: Release with Relizy
run: pnpm relizy release ${{ needs.validate.outputs.release_arguments }} --yes --no-clean
env:
RELIZY_GITHUB_TOKEN: ${{ secrets.PAT }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}