-
Notifications
You must be signed in to change notification settings - Fork 125
180 lines (160 loc) · 8.37 KB
/
release.yaml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# SPDX-License-Identifier: MIT
#
# Copyright (c) 2024 Berachain Foundation
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
name: release
on:
push:
tags:
- "v*"
branches:
- 'release/*'
env:
REPO_NAME: ${{ github.repository_owner }}/beacon-kit
IMAGE_NAME: ${{ github.repository_owner }}/beacon-kit
GH_TOKEN: ${{ secrets.DEV_PAT }}
jobs:
# Job to extract version
extract-version:
name: extract version
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}
# Job to build release
build:
name: build release
needs: extract-version
strategy:
matrix:
configs:
- arch: arm64
target-os: linux
runs-on: ubuntu-latest
- arch: amd64
target-os: linux
runs-on: ubuntu-latest
- arch: arm64
target-os: darwin
runs-on: macos-14
build:
- binary: beacond
runs-on: ${{ matrix.configs.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "^1.23"
env:
GOOS: ${{ matrix.configs.target-os }}
GOARCH: ${{ matrix.configs.arch }}
- name: Build ${{ matrix.build.binary }}, create tarball, and calculate SHA256 checksum
run: |
# Build the binary
make build-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}-${{ needs.extract-version.outputs.VERSION }}
# Display architecture of the build binary
file build/bin/${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}
# Create tar.gz archive
tar -czvf ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}.tar.gz -C build/bin .
# Calculate SHA256 checksum and save to .tar.gz.sha256 file
shasum -a 256 ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}.tar.gz > ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}.tar.gz.sha256
# Upload binaries and SHA256 checksum
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}
path: |
${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}.tar.gz
${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target-os }}-${{ matrix.configs.arch }}.tar.gz.sha256
# Job to draft release
draft-release:
name: draft release
needs: [build, extract-version]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
permissions:
contents: write # Required to post the release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # This is necessary for generating the changelog. It has to come before "Download Artifacts" or else it deletes the artifacts.
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Generate full changelog
id: changelog
run: |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create release draft
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The formatting here is borrowed from Reth (which is borrowed from Lighthouse (which is borrowed from OpenEthereum)):
# https://github.com/openethereum/openethereum/blob/6c2d392d867b058ff867c4373e40850ca3f96969/.github/workflows/build.yml
run: |
body=$(cat <<- "ENDBODY"
![image](https://res.cloudinary.com/duv0g402y/image/upload/v1718034312/BeaconKitBanner.png)
## Testing Checklist (DELETE ME)
- [ ] Run on testnet for 1-3 days.
- [ ] Resync a mainnet node.
- [ ] Ensure all CI checks pass.
## Release Checklist (DELETE ME)
- [ ] Ensure all crates have had their versions bumped.
- [ ] Write the summary.
- [ ] Fill out the update priority.
- [ ] Ensure all binaries have been added.
- [ ] Prepare release posts (Twitter, ...).
## Summary
Add a summary, including:
- Critical bug fixes
- New features
- Any breaking changes (and what to expect)
## Update Priority
This table provides priorities for which classes of users should update particular components.
| User Class | Priority |
|----------------------|-----------------|
| Payload Builders | <TODO> |
| Non-Payload Builders | <TODO> |
## All Changes
${{ steps.changelog.outputs.CHANGELOG }}
## Binaries
| System | Architecture | Binary | PGP Signature | SHA256 Checksum |
|:---:|:---:|:---:|:---:|:---:|
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | amd64 | [beacond-${{ env.VERSION }}-linux-amd64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-linux-amd64.tar.gz) | | [beacond-${{ env.VERSION }}-linux-amd64.sha256](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-linux-amd64.tar.gz.sha256) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | arm64 | [beacond-${{ env.VERSION }}-linux-arm64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-linux-arm64.tar.gz) | | [beacond-${{ env.VERSION }}-linux-arm64.sha256](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-linux-arm64.tar.gz.sha256) |
| <img src="https://simpleicons.org/icons/apple.svg" style="width: 32px;"/> | arm64 | [beacond-${{ env.VERSION }}-darwin-arm64](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-darwin-arm64.tar.gz) | | [beacond-${{ env.VERSION }}-darwin-arm64.sha256](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/beacond-${{ env.VERSION }}-darwin-arm64.tar.gz.sha256) |
| | | | |
| **System** | **Option** | - | **Resource** |
| <img src="https://simpleicons.org/icons/docker.svg" style="width: 32px;"/> | Docker | | [${{ env.IMAGE_NAME }}](https://ghcr.io/berachain/beacon-kit) |
ENDBODY
)
assets=()
for asset in ./*beacond-*.tar.gz*; do
assets+=("$asset/$asset")
done
tag_name="${{ env.VERSION }}"
echo "$body" | gh release create --draft -t "BeaconKit $tag_name" -F "-" "$tag_name" "${assets[@]}"