-
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (105 loc) · 3.64 KB
/
release.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
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
name: Generate Release Candidate
on:
workflow_dispatch:
branches:
- main
inputs:
releaseType:
description: 'Release Type'
required: true
default: 'minor'
type: choice
options:
- major
- minor
- patch
concurrency:
group: generate-release-candidate
cancel-in-progress: true
jobs:
check-permissions:
if: github.actor!='betocantu93'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
with:
script: |
core.setFailed(github.actor + ' is not authorized to run the release script.')
run-release:
if: github.actor!='betocantu93'
name: Generate Release Candidate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
token: ${{ secrets.ENGINEERING_GITHUB_AUTH }}
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "pnpm"
- uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.ENGINEERING_SIGNATURE }}
passphrase: ${{ secrets.ENGINEERING_SIGNATURE_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
git_push_gpgsign: false
- name: Install Dependencies
run: pnpm install
- name: Run Release Script
id: run_release
# after we run the release we force the release branch to be whatever we just released
# this works regardless of whether we released a new patch or a new major/minor
run: |
git checkout $RELEASE_BRANCH
git status
node ./bin/release.mjs -t $RELEASE_TYPE -b $RELEASE_BRANCH
node ./bin/generate-release-notes.mjs
version=v$(cat ./tmp/version.txt)
echo "::set-output name=version::$version"
env:
RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
FROM_BRANCH: ${{ github.event.inputs.releaseType == 'patch' && 'release' || 'main' }}
RELEASE_BRANCH: ${{ github.event.inputs.releaseType == 'patch' && 'release' || 'main' }}
GITHUB_AUTH: ${{ secrets.ENGINEERING_GITHUB_AUTH }}
GH_TOKEN: ${{ secrets.ENGINEERING_GITHUB_AUTH }}
- name: Publish Github Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.run_release.version }}
bodyFile: "./tmp/release-notes.md"
token: ${{ secrets.ENGINEERING_GITHUB_AUTH }}
- name: Update Release Branch
run: |
git checkout release
git reset --hard $FROM_BRANCH
git push origin release -f
update-changelog-for-patch:
if: github.event.inputs.releaseType == 'patch'
name: Update Main Changelog For Patch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
ref: 'main'
token: ${{ secrets.ENGINEERING_GITHUB_AUTH }}
fetch-depth: 1
- uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.ENGINEERING_SIGNATURE }}
passphrase: ${{ secrets.ENGINEERING_SIGNATURE_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
git_push_gpgsign: false
- name: Update Main Changelog
run: |
git fetch origin release --depth=1
git checkout origin/release CHANGELOG.md
VERSION=$(git describe --abbrev=0 --tags origin/release)
git commit -S -am "update CHANGELOG.md for $VERSION"
git push origin main