Skip to content

Commit 2380a71

Browse files
committed
releasing infra
1 parent 622a993 commit 2380a71

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v1.0.0, v0.2.1, etc.
7+
8+
permissions:
9+
contents: write # Required for creating releases and uploading assets
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
include:
19+
- goos: linux
20+
goarch: amd64
21+
binary_name: que
22+
- goos: linux
23+
goarch: arm64
24+
binary_name: que
25+
- goos: darwin
26+
goarch: amd64
27+
binary_name: que
28+
- goos: darwin
29+
goarch: arm64
30+
binary_name: que
31+
- goos: windows
32+
goarch: amd64
33+
binary_name: que.exe
34+
- goos: windows
35+
goarch: arm64
36+
binary_name: que.exe
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version-file: 'go.mod'
46+
47+
- name: Get tag name
48+
id: tag
49+
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
50+
51+
- name: Build binary
52+
env:
53+
GOOS: ${{ matrix.goos }}
54+
GOARCH: ${{ matrix.goarch }}
55+
CGO_ENABLED: 0
56+
run: |
57+
go build -ldflags="-s -w -X main.Version=${{ steps.tag.outputs.TAG_NAME }}" \
58+
-o ${{ matrix.binary_name }} \
59+
./cmd/que
60+
61+
- name: Create archive
62+
shell: bash
63+
run: |
64+
if [ "${{ matrix.goos }}" == "windows" ]; then
65+
zip que-${{ matrix.goos }}-${{ matrix.goarch }}.zip ${{ matrix.binary_name }}
66+
else
67+
tar -czf que-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz ${{ matrix.binary_name }}
68+
fi
69+
70+
- name: Upload artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: que-${{ matrix.goos }}-${{ matrix.goarch }}
74+
path: |
75+
${{ matrix.binary_name }}
76+
que-${{ matrix.goos }}-${{ matrix.goarch }}.*
77+
78+
release:
79+
name: Create Release
80+
needs: build
81+
runs-on: ubuntu-latest
82+
if: startsWith(github.ref, 'refs/tags/')
83+
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Get tag name
89+
id: tag
90+
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
91+
92+
- name: Download all artifacts
93+
uses: actions/download-artifact@v4
94+
with:
95+
path: ./artifacts
96+
97+
- name: Create checksums
98+
shell: bash
99+
working-directory: artifacts
100+
run: |
101+
find . -type f \( -name "que" -o -name "que.exe" -o -name "*.tar.gz" -o -name "*.zip" \) | while read file; do
102+
if command -v sha256sum > /dev/null; then
103+
sha256sum "$file" >> checksums.txt
104+
elif command -v shasum > /dev/null; then
105+
shasum -a 256 "$file" >> checksums.txt
106+
fi
107+
done
108+
109+
- name: Create Release
110+
uses: softprops/action-gh-release@v2
111+
with:
112+
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
113+
name: Release ${{ steps.tag.outputs.TAG_NAME }}
114+
files: |
115+
artifacts/**/*
116+
generate_release_notes: true
117+
draft: false
118+
prerelease: ${{ contains(steps.tag.outputs.TAG_NAME, '-') }}
119+

RELEASES.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Release Process
2+
3+
This project uses GitHub Actions to automatically build and publish binaries when a new tag is pushed.
4+
5+
## How to Create a Release
6+
7+
1. **Update the version** (if needed):
8+
- Update any version references in code or documentation
9+
10+
2. **Create and push a tag**:
11+
```bash
12+
git tag -a v1.0.0 -m "Release version 1.0.0"
13+
git push origin v1.0.0
14+
```
15+
16+
3. **GitHub Actions will automatically**:
17+
- Build binaries for all supported platforms:
18+
- Linux (amd64, arm64)
19+
- macOS (amd64, arm64)
20+
- Windows (amd64, arm64)
21+
- Create a GitHub Release with all binaries attached
22+
- Generate release notes
23+
- Include SHA256 checksums for verification
24+
25+
## Supported Platforms
26+
27+
- **Linux**: `que-linux-amd64.tar.gz`, `que-linux-arm64.tar.gz`
28+
- **macOS**: `que-darwin-amd64.tar.gz`, `que-darwin-arm64.tar.gz`
29+
- **Windows**: `que-windows-amd64.zip`, `que-windows-arm64.zip`
30+
31+
## Tag Naming Convention
32+
33+
- Use semantic versioning: `v1.0.0`, `v0.2.1`, etc.
34+
- Tags starting with `v` will trigger the release workflow
35+
- Pre-release tags (containing `-`) will be marked as pre-releases: `v1.0.0-beta.1`
36+
37+
## Manual Release (if needed)
38+
39+
If you need to create a release manually:
40+
41+
1. Go to the [Releases page](https://github.com/jenian/que/releases)
42+
2. Click "Draft a new release"
43+
3. Select or create a tag
44+
4. Upload the binaries manually
45+
46+
## Verifying Binaries
47+
48+
Each release includes a `checksums.txt` file with SHA256 checksums. Verify a binary:
49+
50+
```bash
51+
# Linux/macOS
52+
sha256sum -c checksums.txt
53+
54+
# macOS (alternative)
55+
shasum -a 256 -c checksums.txt
56+
```
57+

0 commit comments

Comments
 (0)