Skip to content

Commit 916bad0

Browse files
authored
REP-6296 Add a GitHub release process (#121)
This: - adds a GitHub Action that runs whenever a `v`-prefixed semver tag is pushed - adds documentation for the release process - reworks the `build.sh` script to prefer the release version rather than the git revision
1 parent e3b46be commit 916bad0

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
TARGETS: |
10+
linux/amd64
11+
linux/arm64
12+
darwin/arm64
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
build-and-release:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v4
27+
28+
- name: Build
29+
run: |
30+
for target in $TARGETS; do
31+
export GOOS=${target%/*}
32+
export GOARCH=${target#*/}
33+
./build.sh
34+
mv migration_verifier migration_verifier_${GOOS}_${GOARCH}
35+
done
36+
37+
- name: Create Release
38+
uses: softprops/action-gh-release@v2
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
files: migration_verifier_*

RELEASE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Releasing Migration Verifier
2+
3+
To release Migration Verifier, just create a lightweight git tag, thus:
4+
```
5+
git tag v0.0.2
6+
```
7+
… and push it to upstream.
8+
9+
Versions **MUST** start with a `v` and follow
10+
[semantic versioning](https://semver.org/).
11+
12+
An automated release process will build binaries and make them available
13+
for download. Check GitHub Actions for progress.
14+
15+
Note that this process **DOES NOT** create release notes. Users should peruse
16+
the repository’s commit history for changes.

build.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/bin/sh
22

3-
commit=$(git show --no-patch --format='%H')
3+
revision=$(git describe --tags --exact-match 2>/dev/null || echo "DEVELOPMENT:$(git describe --tags)")
44
buildTime=$(date -u)
55

6-
printf 'Building migration-verifier …\n\tcommit: %s\n\tbuildTime: %s\n' "$commit" "$buildTime"
6+
goos=$(go env GOOS)
7+
goarch=$(go env GOARCH)
78

8-
go build -ldflags="-X 'main.Revision=$commit' -X 'main.BuildTime=$buildTime'" main/migration_verifier.go
9+
printf 'Building migration-verifier for %s/%s …\n' "$goos" "$goarch"
10+
printf '\tRevision: %s\n' "$revision"
11+
printf '\tBuild Time: %s\n' "$buildTime"
12+
13+
go build -ldflags="-X 'main.Revision=$revision' -X 'main.BuildTime=$buildTime'" main/migration_verifier.go

0 commit comments

Comments
 (0)