Skip to content

Commit e999bfc

Browse files
committed
Add tag-driven GitHub release workflow
1 parent e607a8a commit e999bfc

3 files changed

Lines changed: 100 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
verify-version:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v4
17+
18+
- name: Verify tag matches Cargo.toml version
19+
shell: bash
20+
run: |
21+
set -euo pipefail
22+
tag_version="${GITHUB_REF_NAME#v}"
23+
cargo_version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)"
24+
if [[ "${tag_version}" != "${cargo_version}" ]]; then
25+
echo "tag version ${tag_version} does not match Cargo.toml version ${cargo_version}" >&2
26+
exit 1
27+
fi
28+
29+
build:
30+
needs: verify-version
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- os: ubuntu-latest
36+
target: x86_64-unknown-linux-gnu
37+
archive_name: devloop-x86_64-unknown-linux-gnu.tar.gz
38+
- os: macos-13
39+
target: x86_64-apple-darwin
40+
archive_name: devloop-x86_64-apple-darwin.tar.gz
41+
- os: macos-14
42+
target: aarch64-apple-darwin
43+
archive_name: devloop-aarch64-apple-darwin.tar.gz
44+
runs-on: ${{ matrix.os }}
45+
steps:
46+
- name: Check out repository
47+
uses: actions/checkout@v4
48+
49+
- name: Install Rust toolchain
50+
uses: dtolnay/rust-toolchain@stable
51+
with:
52+
targets: ${{ matrix.target }}
53+
54+
- name: Cache cargo artifacts
55+
uses: Swatinem/rust-cache@v2
56+
57+
- name: Build release binary
58+
run: cargo build --release --target ${{ matrix.target }}
59+
60+
- name: Package release archive
61+
shell: bash
62+
run: |
63+
set -euo pipefail
64+
mkdir -p dist
65+
cp "target/${{ matrix.target }}/release/devloop" dist/devloop
66+
tar -C dist -czf "${{ matrix.archive_name }}" devloop
67+
68+
- name: Upload release asset
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: ${{ matrix.archive_name }}
72+
path: ${{ matrix.archive_name }}
73+
74+
publish:
75+
needs: build
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Download release assets
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: release-assets
82+
83+
- name: Flatten release assets
84+
shell: bash
85+
run: |
86+
set -euo pipefail
87+
mkdir -p dist
88+
find release-assets -type f -name '*.tar.gz' -exec cp {} dist/ \;
89+
90+
- name: Publish GitHub release
91+
uses: softprops/action-gh-release@v2
92+
with:
93+
files: dist/*.tar.gz
94+
generate_release_notes: true

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ All notable changes to `devloop` will be recorded in this file.
1717
- Added `devloop docs <topic>` so the configuration, behavior, and
1818
security references can be read directly from the CLI without
1919
duplicating the source material.
20+
- Added a tag-driven GitHub release workflow that verifies the Cargo
21+
version, builds release archives for Linux and macOS, and publishes
22+
them as GitHub Release assets.
2023

2124
### Changed
2225
- Moved workflow progression into a pure state/effect core so ordered

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Install the latest published `main` branch directly from GitHub:
4747
cargo install --git https://github.com/pasunboneleve/devloop.git
4848
```
4949

50+
Tagged releases are also published automatically on GitHub with
51+
prebuilt release archives for Linux and macOS.
52+
5053
For local development from a checkout:
5154

5255
```bash

0 commit comments

Comments
 (0)