Skip to content

Commit 2dd8ff3

Browse files
Add automated GitHub releases workflow (#3835)
## Summary Implements automated GitHub releases triggered by version tags, resolving the TODO for `softprops/action-gh-release` integration. ## Changes - **Release workflow** (`.github/workflows/release.yml`): Tag-triggered automation that builds multi-platform binaries, runs tests, and creates releases with generated notes - **Client workflow update**: Replace TODO with reference to dedicated release workflow - **Documentation** (`docs/release-process.md`): Release guide and troubleshooting ## Usage **Before**: Manual workflow dispatch → download artifacts → create release manually **After**: `git tag v2.1.1 && git push origin v2.1.1` → automated release ## Test Plan 1. Merge PR 2. Test with `v2.1.1-test` tag 3. Create production release with `v2.1.1` tag
2 parents b2c82c8 + 9faf25b commit 2dd8ff3

File tree

3 files changed

+212
-1
lines changed

3 files changed

+212
-1
lines changed

.github/workflows/client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
required: false
2929
default: "main"
3030

31-
# TODO: Implement automatic releases creation on tags push with https://github.com/softprops/action-gh-release
31+
# Automatic releases are now handled by the dedicated release.yml workflow
3232

3333
jobs:
3434
client-detect-changes:

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
# Fetch the whole history for the `git describe` command to work.
18+
fetch-depth: 0
19+
20+
- name: Resolve versions
21+
run: |
22+
echo "version=$(git describe --tags --match 'v[0-9]*' HEAD)" \
23+
>> $GITHUB_ENV
24+
echo "revision=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Cache Docker layers
30+
uses: actions/cache@v4
31+
with:
32+
path: /tmp/.buildx-cache
33+
key: ${{ runner.os }}-buildx-${{ github.sha }}
34+
restore-keys: |
35+
${{ runner.os }}-buildx-
36+
37+
- name: Build Docker Build Image
38+
uses: docker/build-push-action@v5
39+
with:
40+
target: build-docker
41+
tags: go-build-env
42+
build-args: |
43+
VERSION=${{ env.version }}
44+
REVISION=${{ env.revision }}
45+
# load image to local registry to use it in next steps
46+
load: true
47+
cache-from: type=local,src=/tmp/.buildx-cache
48+
cache-to: type=local,dest=/tmp/.buildx-cache-new
49+
context: .
50+
51+
- name: Run Go tests
52+
run: |
53+
docker run \
54+
--workdir /go/src/github.com/keep-network/keep-core \
55+
go-build-env \
56+
gotestsum -- -timeout 15m
57+
58+
- name: Build Client Binaries
59+
uses: docker/build-push-action@v5
60+
with:
61+
target: output-bins
62+
outputs: type=local,dest=./out/bin/
63+
build-args: |
64+
ENVIRONMENT=mainnet
65+
VERSION=${{ env.version }}
66+
REVISION=${{ env.revision }}
67+
push: false
68+
context: .
69+
70+
- name: Generate release notes
71+
id: release_notes
72+
run: |
73+
# Get the previous tag for release notes
74+
PREV_TAG=$(git describe --tags --abbrev=0 --match 'v[0-9]*' \
75+
HEAD^ 2>/dev/null || echo "")
76+
77+
# Create release notes
78+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
79+
echo "## Keep Core ${{ env.version }}" >> $GITHUB_OUTPUT
80+
echo "" >> $GITHUB_OUTPUT
81+
echo "Built from commit: ${{ env.revision }}" >> $GITHUB_OUTPUT
82+
echo "" >> $GITHUB_OUTPUT
83+
echo "### Downloads" >> $GITHUB_OUTPUT
84+
echo "- **Linux AMD64**: \`keep-client-mainnet-${{ env.version }}-linux-amd64.tar.gz\`" \
85+
>> $GITHUB_OUTPUT
86+
echo "- **macOS AMD64**: \`keep-client-mainnet-${{ env.version }}-darwin-amd64.tar.gz\`" \
87+
>> $GITHUB_OUTPUT
88+
echo "" >> $GITHUB_OUTPUT
89+
echo "### Verification" >> $GITHUB_OUTPUT
90+
echo "All binaries include MD5 and SHA256 checksums for verification." \
91+
>> $GITHUB_OUTPUT
92+
echo "" >> $GITHUB_OUTPUT
93+
if [ -n "$PREV_TAG" ]; then
94+
echo "### Changes since $PREV_TAG" >> $GITHUB_OUTPUT
95+
git log --oneline --no-merges "$PREV_TAG..HEAD" | head -20 \
96+
>> $GITHUB_OUTPUT
97+
fi
98+
echo "EOF" >> $GITHUB_OUTPUT
99+
100+
- name: Create GitHub Release
101+
uses: softprops/action-gh-release@v2
102+
with:
103+
name: Release ${{ env.version }}
104+
body: ${{ steps.release_notes.outputs.RELEASE_NOTES }}
105+
files: |
106+
out/bin/*.tar.gz
107+
out/bin/*.md5
108+
out/bin/*.sha256
109+
draft: false
110+
prerelease: ${{ contains(env.version, '-') }}
111+
generate_release_notes: false
112+
113+
- name: Move cache
114+
run: |
115+
rm -rf /tmp/.buildx-cache
116+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

docs/release-process.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Keep Core Release Process
2+
3+
## Automated Releases
4+
5+
Keep Core now supports fully automated releases through GitHub Actions. When you push a version tag, the system automatically:
6+
7+
1. Builds multi-platform binaries
8+
2. Runs tests to ensure quality
9+
3. Creates a GitHub release with artifacts
10+
4. Generates release notes
11+
12+
## Creating a Release
13+
14+
### 1. Prepare the Release
15+
16+
Ensure you're on the main branch with all changes merged:
17+
18+
```bash
19+
git checkout main
20+
git pull origin main
21+
```
22+
23+
### 2. Create and Push a Version Tag
24+
25+
```bash
26+
# For a new patch release
27+
git tag v2.1.1
28+
29+
# For a new minor release
30+
git tag v2.2.0
31+
32+
# For a pre-release
33+
git tag v2.2.0-rc.1
34+
35+
# Push the tag to trigger the release
36+
git push origin v2.1.1
37+
```
38+
39+
### 3. Monitor the Release
40+
41+
1. Go to the [Actions tab](../../actions) in GitHub
42+
2. Watch the "Release" workflow complete
43+
3. Check the [Releases page](../../releases) for the new release
44+
45+
## Release Artifacts
46+
47+
Each release automatically includes:
48+
49+
- **Linux AMD64 binary**: `keep-client-mainnet-{version}-linux-amd64.tar.gz`
50+
- **macOS AMD64 binary**: `keep-client-mainnet-{version}-darwin-amd64.tar.gz`
51+
- **Checksums**: `.md5` and `.sha256` files for verification
52+
53+
## Version Numbering
54+
55+
Follow [Semantic Versioning](https://semver.org/):
56+
57+
- **Patch** (`v2.1.1`): Bug fixes, security patches
58+
- **Minor** (`v2.2.0`): New features, backwards compatible
59+
- **Major** (`v3.0.0`): Breaking changes
60+
- **Pre-release** (`v2.2.0-rc.1`): Release candidates, alpha/beta versions
61+
62+
## Pre-releases
63+
64+
Tags containing hyphens (e.g., `v2.2.0-rc.1`, `v2.2.0-alpha.1`) are automatically marked as pre-releases.
65+
66+
## Manual Release (Legacy)
67+
68+
If automatic releases fail, you can still create releases manually:
69+
70+
1. Use `workflow_dispatch` on the client workflow
71+
2. Download artifacts from the workflow run
72+
3. Create a GitHub release manually
73+
4. Upload the downloaded artifacts
74+
75+
## Troubleshooting
76+
77+
### Release Workflow Fails
78+
79+
1. Check the Actions logs for specific errors
80+
2. Ensure the tag follows the `v*` pattern
81+
3. Verify tests are passing on the main branch
82+
83+
### Missing Artifacts
84+
85+
1. Check if the Docker build completed successfully
86+
2. Verify the `output-bins` target in the Dockerfile
87+
3. Ensure artifact paths match the workflow configuration
88+
89+
## Configuration
90+
91+
The release process is configured in:
92+
93+
- `.github/workflows/release.yml` - Main release automation
94+
- `Makefile` - Build configuration and binary naming
95+
- `Dockerfile` - Multi-stage build for binaries

0 commit comments

Comments
 (0)