Skip to content

Bump version to 1.0.0 #3

Bump version to 1.0.0

Bump version to 1.0.0 #3

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
RUSTC_WRAPPER: sccache
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux linker
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y clang lld
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.5
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install Zig
run: ./scripts/bootstrap-zig.sh
- name: Build
env:
ZIG: ${{ github.workspace }}/.context/zig/zig
run: cargo build -p cas --release --target ${{ matrix.target }}
- name: Package (Unix)
run: |
mkdir -p package
cp target/${{ matrix.target }}/release/cas package/
cp LICENSE package/
cd package
tar -czvf cas-${{ matrix.target }}.tar.gz cas LICENSE
mv cas-${{ matrix.target }}.tar.gz ../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cas-${{ matrix.target }}
path: cas-${{ matrix.target }}.tar.gz
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
find artifacts -name "*.tar.gz" -exec mv {} release/ \;
ls -la release/
- name: Generate release notes
id: notes
run: |
# Get the previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s" $PREV_TAG..HEAD)
else
NOTES=$(git log --pretty=format:"- %s" -10)
fi
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${GITHUB_REF#refs/tags/}"
# Delete existing release if it exists (handles retags)
gh release delete "$VERSION" --repo ${{ github.repository }} --yes 2>/dev/null || true
# Create the release
gh release create "$VERSION" \
--repo ${{ github.repository }} \
--title "CAS $VERSION" \
--notes "${{ steps.notes.outputs.notes }}" \
release/*
update-homebrew:
name: Update Homebrew Formula
needs: release
runs-on: ubuntu-latest
# Requires HOMEBREW_TAP_TOKEN secret: a PAT with push access to codingagentsystem/homebrew-cas
steps:
- uses: actions/checkout@v4
- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "HOMEBREW_TAP_TOKEN not set, skipping homebrew update"
exit 0
fi
VERSION="${GITHUB_REF#refs/tags/v}"
# Download and compute SHA256 for each platform
MACOS_SHA=$(curl -fsSL "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/cas-aarch64-apple-darwin.tar.gz" | shasum -a 256 | cut -d' ' -f1)
LINUX_SHA=$(curl -fsSL "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/cas-x86_64-unknown-linux-gnu.tar.gz" | shasum -a 256 | cut -d' ' -f1)
# Clone homebrew-cas tap
git clone https://x-access-token:${GH_TOKEN}@github.com/codingagentsystem/homebrew-cas.git /tmp/homebrew-cas
cd /tmp/homebrew-cas
# Update version and SHA256 hashes in formula
sed -i "s/version \"[^\"]*\"/version \"${VERSION}\"/" Formula/cas.rb
sed -i "0,/sha256 \"[a-f0-9]\{64\}\"/s/sha256 \"[a-f0-9]\{64\}\"/sha256 \"${MACOS_SHA}\"/" Formula/cas.rb
sed -i "/sha256 \"${MACOS_SHA}\"/!s/sha256 \"[a-f0-9]\{64\}\"/sha256 \"${LINUX_SHA}\"/" Formula/cas.rb
# Commit and push
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/cas.rb
git commit -m "Update CAS to ${VERSION}"
git push