-
Notifications
You must be signed in to change notification settings - Fork 108
89 lines (77 loc) · 2.85 KB
/
rc-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
name: Publish Release Candidate Release
on:
push:
tags:
- "v*.*.*-rc"
concurrency:
group: publish-rc-release
cancel-in-progress: false
env:
GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')"
jobs:
pre-release-checks:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Major Version in Upgrade Handler Must Match Tag
run: |
UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f1)
echo $UPGRADE_HANDLER_MAJOR_VERSION
GITHUB_TAG_MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f1)
if [ $GITHUB_TAG_MAJOR_VERSION != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
echo "ERROR: The major version of this release (${{ github.ref_name }}) does not match the major version in the releaseVersion constant ($UPGRADE_HANDLER_MAJOR_VERSION) found in app/setup_handlers.go"
echo "Did you forget to update the 'releaseVersion' in app/setup_handlers.go?"
exit 1
fi
echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
publish-release:
runs-on: ubuntu-22.04
timeout-minutes: 60
needs:
- pre-release-checks
steps:
- uses: actions/checkout@v4
- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
- name: Echo Release Notes from PR Message.
id: release_notes
run: |
cat changelog.md > ${{ github.workspace }}-CHANGELOG.txt
cat ${{ github.workspace }}-CHANGELOG.txt
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "true"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
generate_release_notes: true
- name: Publish Release Files
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
run: |
touch .release-env
make release
- name: Clean Up Workspace
if: always()
shell: bash
run: sudo rm -rf * || echo "failed to clean workspace please investigate"