Skip to content

Commit bdf3369

Browse files
dittopsclaude
andcommitted
Add release workflow for binaries and Docker image
Builds binaries for linux/macOS (x86_64 + aarch64), generates checksums, creates a GitHub release, and pushes a multi-arch Docker image to GHCR. Triggered on version tags (v*). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cab1cea commit bdf3369

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build:
19+
strategy:
20+
matrix:
21+
include:
22+
- target: x86_64-unknown-linux-gnu
23+
os: ubuntu-latest
24+
asset: taskgraph-linux-x86_64
25+
- target: aarch64-unknown-linux-gnu
26+
os: ubuntu-latest
27+
asset: taskgraph-linux-aarch64
28+
- target: x86_64-apple-darwin
29+
os: macos-latest
30+
asset: taskgraph-darwin-x86_64
31+
- target: aarch64-apple-darwin
32+
os: macos-latest
33+
asset: taskgraph-darwin-aarch64
34+
35+
runs-on: ${{ matrix.os }}
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Install Rust toolchain
41+
run: |
42+
rustup target add ${{ matrix.target }}
43+
44+
- name: Install cross-compilation tools
45+
if: matrix.target == 'aarch64-unknown-linux-gnu'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y gcc-aarch64-linux-gnu
49+
50+
- name: Build
51+
env:
52+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
53+
run: cargo build --release --target ${{ matrix.target }}
54+
55+
- name: Package binary
56+
run: |
57+
cp target/${{ matrix.target }}/release/taskgraph ${{ matrix.asset }}
58+
chmod +x ${{ matrix.asset }}
59+
60+
- name: Upload artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ matrix.asset }}
64+
path: ${{ matrix.asset }}
65+
66+
release:
67+
needs: build
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Download all artifacts
74+
uses: actions/download-artifact@v4
75+
with:
76+
path: artifacts
77+
78+
- name: Prepare release assets
79+
run: |
80+
mkdir release
81+
for dir in artifacts/*/; do
82+
cp "$dir"* release/
83+
done
84+
cd release
85+
sha256sum taskgraph-* > checksums.txt
86+
cat checksums.txt
87+
88+
- name: Create GitHub release
89+
uses: softprops/action-gh-release@v2
90+
with:
91+
generate_release_notes: true
92+
files: release/*
93+
94+
docker:
95+
needs: release
96+
runs-on: ubuntu-latest
97+
98+
steps:
99+
- uses: actions/checkout@v4
100+
101+
- name: Set up Docker Buildx
102+
uses: docker/setup-buildx-action@v3
103+
104+
- name: Set up QEMU
105+
uses: docker/setup-qemu-action@v3
106+
107+
- name: Log in to GHCR
108+
uses: docker/login-action@v3
109+
with:
110+
registry: ${{ env.REGISTRY }}
111+
username: ${{ github.actor }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113+
114+
- name: Extract metadata
115+
id: meta
116+
uses: docker/metadata-action@v5
117+
with:
118+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
119+
tags: |
120+
type=semver,pattern={{version}}
121+
type=semver,pattern={{major}}.{{minor}}
122+
type=raw,value=latest
123+
124+
- name: Build and push
125+
uses: docker/build-push-action@v6
126+
with:
127+
context: .
128+
platforms: linux/amd64,linux/arm64
129+
push: true
130+
tags: ${{ steps.meta.outputs.tags }}
131+
labels: ${{ steps.meta.outputs.labels }}
132+
cache-from: type=gha
133+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)