Add CI and release GitHub Actions workflows
CI runs fmt/check/clippy/test on push and PRs. Release is manually
triggered: merges main into the release branch, builds a macOS binary
with the calver+sha version baked in, and creates a GitHub release.
Assisted-by: Claude Opus 4.6 via pi
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..81a84e8
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,19 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+jobs:
+ ci:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@stable
+ with:
+ components: clippy, rustfmt
+ - run: cargo fmt --check
+ - run: cargo check
+ - run: cargo clippy
+ - run: cargo test
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..a41c11b
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,54 @@
+name: Release
+
+on:
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - uses: dtolnay/rust-toolchain@stable
+
+ - name: Calculate version
+ id: version
+ run: |
+ CALVER=$(date -u +"%Y-%m-%d")
+ SHORT_SHA=$(git rev-parse --short HEAD)
+ echo "version=${CALVER}+${SHORT_SHA}" >> $GITHUB_OUTPUT
+
+ - name: Merge into release branch
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+
+ if git fetch origin release 2>/dev/null; then
+ git checkout -B release origin/release
+ git merge --no-ff -X theirs main -m "Release ${{ steps.version.outputs.version }}"
+ else
+ git checkout -b release
+ fi
+
+ - name: Build
+ run: |
+ PINCH_VERSION="${{ steps.version.outputs.version }}" cargo build --release
+ cp target/release/pinch pinch-aarch64-apple-darwin
+
+ - name: Publish
+ run: |
+ VERSION="${{ steps.version.outputs.version }}"
+ git tag "v${VERSION}"
+ git push origin release "v${VERSION}"
+
+ gh release create "v${VERSION}" \
+ --title "v${VERSION}" \
+ --generate-notes \
+ pinch-aarch64-apple-darwin
+ env:
+ GH_TOKEN: ${{ github.token }}