Skip to content

Commit 27a3e83

Browse files
committed
Automate releases
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
1 parent f4d117b commit 27a3e83

2 files changed

Lines changed: 75 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
permissions:
7+
contents: write
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version: 1.25
19+
- name: Login to Quay.io
20+
uses: docker/login-action@v3
21+
with:
22+
registry: quay.io
23+
username: ${{ secrets.QUAY_USERNAME }}
24+
password: ${{ secrets.QUAY_PASSWORD }}
25+
- name: Prepare release notes
26+
run: |
27+
TAG=${GITHUB_REF#refs/tags/}
28+
VERSION=${TAG#v}
29+
NOTES_FILE=changelogs/${TAG}.md
30+
if [ ! -f "${NOTES_FILE}" ]; then
31+
echo "Release notes file ${NOTES_FILE} not found"
32+
exit 1
33+
fi
34+
cp "${NOTES_FILE}" /tmp/release-notes.md
35+
cat >> /tmp/release-notes.md <<EOF
36+
37+
38+
## Docker images
39+
40+
- \`docker pull quay.io/cortexproject/cortex-tools:${TAG}\`
41+
- \`docker pull quay.io/cortexproject/benchtool:${TAG}\`
42+
EOF
43+
- name: Run GoReleaser
44+
uses: goreleaser/goreleaser-action@v6
45+
with:
46+
version: v2.11.4
47+
args: release --release-notes=/tmp/release-notes.md --clean
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RELEASE.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
# Release processes
1+
# Release process
22

3-
## GoReleaser (`cortextool` only)
3+
Releases are automated via the `Release` GitHub Actions workflow (`.github/workflows/release.yml`). Pushing a tag matching `v*` triggers it: it builds binaries with goreleaser, pushes Docker images to quay.io, and publishes the GitHub release with notes from `changelogs/${tag}.md`.
44

5-
1. Create a changelog file in `changelog/` with the name of the tag e.g. `changelog/v0.3.0.md`. This will be used as the template for the release page in GitHub.
6-
2. Create a new tag that follows semantic versioning:
5+
## Steps
76

8-
```bash
9-
$ tag=v0.3.0
10-
$ git tag -s "${tag}" -m "${tag}"
11-
$ git push origin "${tag}"
12-
```
7+
1. **Open a PR** that adds:
8+
- An entry in `CHANGELOG.md` for the new version
9+
- A `changelogs/${tag}.md` file (used as the GitHub release body — see existing files for the format)
1310

14-
3. Run `$ goreleaser release --release-notes=changelogs/v0.3.0.md --clean` where the changelog file is the one created as part of step 1.
15-
4. The docker image will be pushed automatically.
11+
2. **Once the PR is merged**, create a signed tag and push it:
1612

13+
```bash
14+
tag=v0.3.0
15+
git checkout main && git pull origin main
16+
git tag -s "${tag}" -m "${tag}"
17+
git push origin "${tag}"
18+
```
1719

18-
## Manual (all the other binaries)
20+
3. **Watch the workflow** at https://github.com/cortexproject/cortex-tools/actions
1921

20-
1. Manually build and test the new additions
21-
2. Create a new tag based on:
22-
$ tag=v0.2.1
23-
$ git tag -s "${tag}" -m "${tag}"
24-
$ git push origin "${tag}"
22+
On success:
23+
- Binaries for cortextool and benchtool (linux, mac-os, windows) are attached to the release
24+
- Docker images are pushed to `quay.io/cortexproject/cortex-tools:${tag}` and `quay.io/cortexproject/benchtool:${tag}`
25+
- The release notes include a Docker images section appended automatically
2526

26-
3. Create the binaries with `make cross`, they are in dist/
27-
4. Create the GitHub release, copy the release notes from the previous ones, and adjust as necessary. Upload the binaries created and click publish on the release.
28-
5. The last step is creating and uploading the docker images. Use make image to create them and then tag them. Keep in mind that there is only 1 image for cortextool in Dockerhub at the moment.
29-
6. Make sure to update the latest tag to the most recent version.
27+
## Required secrets
28+
29+
The workflow uses two repository secrets:
30+
31+
- `QUAY_USERNAME`
32+
- `QUAY_PASSWORD`
33+
34+
`GITHUB_TOKEN` is provided automatically by Actions.

0 commit comments

Comments
 (0)