Skip to content

Commit f123b7d

Browse files
timabellclaude
andcommitted
feat: Add GitHub Actions workflows for automated binary builds and releases
- Create reusable CI workflow (_ci.yml) with cross-platform builds for Linux, Windows, and macOS (including Apple Silicon) - Add release workflow (_release.yml) with git-cliff integration for automated release notes - Set up build triggers for main branch, PRs, and tagged releases - Configure cargo-deny and cargo-machete for dependency validation - Add git-cliff configuration (cliff.toml) for conventional commit changelog generation - Remove legacy ci.yml to eliminate workflow conflicts - Fix workspace binary building using --package instead of --bin - Update to libwebkit2gtk-4.1-dev and extend artifact retention to 7 days prompts: - build a github action workflow to automatically build downloadable binaries for the dioxus and cli app, with automatic release notes from cliff. Make it as similar to https://github.com/rustworkshop/gitopolis/tree/main/.github as you can 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fc1e7cb commit f123b7d

8 files changed

Lines changed: 356 additions & 70 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"Bash(cargo insta:*)",
1919
"WebFetch(domain:crates.io)",
2020
"WebFetch(domain:docs.rs)",
21-
"WebFetch(domain:github.com)"
21+
"WebFetch(domain:github.com)",
22+
"WebFetch(domain:raw.githubusercontent.com)"
2223
],
2324
"deny": []
2425
}
25-
}
26+
}

.github/workflows/_ci.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release_tag:
7+
description: 'Release tag for version updates'
8+
required: false
9+
type: string
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
get-rust-version:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
rust-version: ${{ steps.get-rust-version.outputs.rust-version }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Get rust version
23+
id: get-rust-version
24+
run: |
25+
if [ -f .tool-versions ]; then
26+
echo "rust-version=$(cat .tool-versions | grep rust | cut -d' ' -f2)" >> $GITHUB_OUTPUT
27+
else
28+
echo "rust-version=stable" >> $GITHUB_OUTPUT
29+
fi
30+
31+
deny:
32+
runs-on: ubuntu-latest
33+
needs: get-rust-version
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: dtolnay/rust-toolchain@master
38+
with:
39+
toolchain: ${{ needs.get-rust-version.outputs.rust-version }}
40+
41+
- uses: Swatinem/rust-cache@v2
42+
with:
43+
cache-on-failure: true
44+
45+
- name: Install cargo-deny
46+
uses: taiki-e/install-action@v2
47+
with:
48+
tool: cargo-deny
49+
50+
- name: Run cargo-deny
51+
run: cargo deny check
52+
53+
machete:
54+
runs-on: ubuntu-latest
55+
needs: get-rust-version
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- uses: dtolnay/rust-toolchain@master
60+
with:
61+
toolchain: ${{ needs.get-rust-version.outputs.rust-version }}
62+
63+
- uses: Swatinem/rust-cache@v2
64+
with:
65+
cache-on-failure: true
66+
67+
- name: Install cargo-machete
68+
uses: taiki-e/install-action@v2
69+
with:
70+
tool: cargo-machete
71+
72+
- name: Run cargo-machete
73+
run: cargo machete
74+
75+
build:
76+
runs-on: ${{ matrix.runner }}
77+
needs: get-rust-version
78+
strategy:
79+
matrix:
80+
include:
81+
- runner: ubuntu-latest
82+
target: x86_64-unknown-linux-musl
83+
os: linux
84+
- runner: windows-latest
85+
target: x86_64-pc-windows-msvc
86+
os: windows
87+
- runner: macos-13
88+
target: x86_64-apple-darwin
89+
os: macos
90+
- runner: macos-latest
91+
target: aarch64-apple-darwin
92+
os: macos-arm64
93+
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- uses: dtolnay/rust-toolchain@master
98+
with:
99+
toolchain: ${{ needs.get-rust-version.outputs.rust-version }}
100+
targets: ${{ matrix.target }}
101+
102+
- uses: Swatinem/rust-cache@v2
103+
with:
104+
cache-on-failure: true
105+
106+
- name: Install Linux dependencies
107+
if: matrix.os == 'linux'
108+
run: |
109+
sudo apt-get update
110+
sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libwebkit2gtk-4.1-dev musl-tools
111+
112+
- name: Install macOS dependencies
113+
if: startsWith(matrix.os, 'macos')
114+
run: |
115+
brew install create-dmg
116+
117+
- name: Update version in Cargo.toml
118+
if: inputs.release_tag != ''
119+
shell: bash
120+
run: |
121+
version="${{ inputs.release_tag }}"
122+
version="${version#v}" # Remove 'v' prefix if present
123+
sed -i.bak "s/^version = .*/version = \"$version\"/" Cargo.toml
124+
125+
- name: Build CLI binary
126+
run: |
127+
cargo build --release --target ${{ matrix.target }} --package markdown-neuraxis-cli
128+
129+
- name: Build Dioxus binary
130+
run: |
131+
cargo build --release --target ${{ matrix.target }} --package markdown-neuraxis-dioxus
132+
133+
- name: Run tests
134+
run: cargo test --release --target ${{ matrix.target }}
135+
136+
- name: Prepare artifacts
137+
shell: bash
138+
run: |
139+
mkdir -p artifacts
140+
141+
if [ "${{ matrix.os }}" = "windows" ]; then
142+
cli_bin="target/${{ matrix.target }}/release/markdown-neuraxis-cli.exe"
143+
dioxus_bin="target/${{ matrix.target }}/release/markdown-neuraxis-dioxus.exe"
144+
cp "$cli_bin" "artifacts/markdown-neuraxis-cli-${{ matrix.os }}.exe"
145+
cp "$dioxus_bin" "artifacts/markdown-neuraxis-dioxus-${{ matrix.os }}.exe"
146+
else
147+
cli_bin="target/${{ matrix.target }}/release/markdown-neuraxis-cli"
148+
dioxus_bin="target/${{ matrix.target }}/release/markdown-neuraxis-dioxus"
149+
cp "$cli_bin" "artifacts/markdown-neuraxis-cli-${{ matrix.os }}"
150+
cp "$dioxus_bin" "artifacts/markdown-neuraxis-dioxus-${{ matrix.os }}"
151+
fi
152+
153+
- name: Upload artifacts
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: markdown-neuraxis-${{ matrix.os }}
157+
path: artifacts/
158+
retention-days: 7

.github/workflows/_release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release_tag:
7+
description: 'Release tag'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Generate release notes
24+
id: generate-notes
25+
uses: orhun/git-cliff-action@v4
26+
with:
27+
config: cliff.toml
28+
args: --verbose --unreleased --tag ${{ inputs.release_tag }}
29+
env:
30+
OUTPUT: CHANGES.md
31+
GITHUB_REPO: ${{ github.repository }}
32+
33+
- name: Download Linux artifacts
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: markdown-neuraxis-linux
37+
path: ./release-artifacts
38+
39+
- name: Download Windows artifacts
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: markdown-neuraxis-windows
43+
path: ./release-artifacts
44+
45+
- name: Download macOS artifacts
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: markdown-neuraxis-macos
49+
path: ./release-artifacts
50+
51+
- name: Generate checksums
52+
run: |
53+
cd release-artifacts
54+
sha256sum * > checksums.txt
55+
cat checksums.txt
56+
57+
- name: Release
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
tag_name: ${{ inputs.release_tag }}
61+
name: ${{ inputs.release_tag }}
62+
body_path: CHANGES.md
63+
files: |
64+
release-artifacts/markdown-neuraxis-cli-*
65+
release-artifacts/markdown-neuraxis-dioxus-*
66+
release-artifacts/checksums.txt

.github/workflows/build-main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Build Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
uses: ./.github/workflows/_ci.yml

.github/workflows/build-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Build PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
ci:
9+
uses: ./.github/workflows/_ci.yml

.github/workflows/build-tag.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Build Tag
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
ci:
9+
uses: ./.github/workflows/_ci.yml
10+
with:
11+
release_tag: ${{ github.ref_name }}
12+
13+
release:
14+
needs: ci
15+
uses: ./.github/workflows/_release.yml
16+
with:
17+
release_tag: ${{ github.ref_name }}

.github/workflows/ci.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)