-
Notifications
You must be signed in to change notification settings - Fork 2.7k
59 lines (50 loc) · 1.7 KB
/
exit-prerelease.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
name: Exit Prerelease Mode
on:
workflow_dispatch:
inputs:
branch:
description: "Exit prerelease mode on release branch"
type: string
default: "release-"
required: true
jobs:
exit_prerelease:
name: Changesets Exit Prerelease
runs-on: ubuntu-latest
# Allow GITHUB_TOKEN to have write permissions
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
# Checkout release branch entered when workflow was kicked off
ref: ${{ github.event.inputs.branch }}
# Fetch entire git history so Changesets can generate changelogs
# with the correct commits
fetch-depth: 0
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Get latest tagged version
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Remove 'v' prefix from version number (e.g. v1.0.0)
uses: mad9000/actions-find-and-replace-string@4
id: formatversion
with:
source: ${{ steps.previoustag.outputs.tag }}
find: "v"
replace: ""
- name: Write previous version to package.json
uses: jaywcjlove/[email protected]
with:
version: ${{ steps.formatversion.outputs.value }}
- name: Remove pre.json
run: npx rimraf .changeset/pre.json
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Exit prerelease mode
# Commit these changes to the branch workflow is running against
branch: ${{ github.event.inputs.branch }}