Skip to content

chore: prepare v0.4.0 release #5

chore: prepare v0.4.0 release

chore: prepare v0.4.0 release #5

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: read
jobs:
validate:
name: Validate tag
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Match tag to workspace version
shell: bash
run: |
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "expected a release tag like v0.2.0, got $GITHUB_REF_NAME" >&2
exit 1
fi
tag_version="${GITHUB_REF_NAME#v}"
workspace_version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)"
if [[ "$tag_version" != "$workspace_version" ]]; then
echo "tag $GITHUB_REF_NAME does not match workspace version $workspace_version" >&2
exit 1
fi
plugin_version="$(node -p "require('./plugins/devsite-access/.codex-plugin/plugin.json').version")"
if [[ "$tag_version" != "$plugin_version" ]]; then
echo "tag $GITHUB_REF_NAME does not match devsite-access plugin version $plugin_version" >&2
exit 1
fi
test:
name: Test workspace
needs: validate
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install stable Rust
run: |
rustup update stable
rustup default stable
- name: Test
run: cargo test --workspace --locked
build:
name: Build ${{ matrix.target }}
needs: validate
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15
target: aarch64-apple-darwin
- runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- runner: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
- runner: windows-2025
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.runner }}
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install stable Rust
shell: bash
run: |
rustup update stable
rustup default stable
rustup target add "${{ matrix.target }}"
- name: Build CLI
shell: bash
run: cargo build --locked --release -p devsite-cli --target "${{ matrix.target }}"
- name: Smoke test CLI
shell: bash
run: |
binary="target/${{ matrix.target }}/release/devsite"
if [[ "${{ runner.os }}" == "Windows" ]]; then
binary="$binary.exe"
fi
"$binary" --version | grep -Fx "devsite ${GITHUB_REF_NAME#v}"
- name: Package archive
if: runner.os != 'Windows'
shell: bash
run: |
name="devsite-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir -p "dist/$name/plugins"
install -m 0755 "target/${{ matrix.target }}/release/devsite" "dist/$name/devsite"
cp README.md LICENSE "dist/$name/"
cp -R docs skills "dist/$name/"
cp -R plugins/devsite-access "dist/$name/plugins/"
tar -C dist -czf "dist/$name.tar.gz" "$name"
rm -rf "dist/$name"
- name: Package archive
if: runner.os == 'Windows'
shell: pwsh
run: |
$name = "devsite-$env:GITHUB_REF_NAME-${{ matrix.target }}"
New-Item -ItemType Directory -Path "dist/$name" | Out-Null
Copy-Item "target/${{ matrix.target }}/release/devsite.exe" "dist/$name/devsite.exe"
Copy-Item README.md, LICENSE "dist/$name/"
Copy-Item docs, skills -Destination "dist/$name" -Recurse
New-Item -ItemType Directory -Path "dist/$name/plugins" | Out-Null
Copy-Item plugins/devsite-access -Destination "dist/$name/plugins" -Recurse
Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip"
Remove-Item -Recurse "dist/$name"
- name: Attest archive provenance
if: github.event.repository.private == false
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
with:
subject-path: dist/*
- name: Upload archive
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.target }}
path: dist/*
if-no-files-found: error
release:
name: Publish release
needs:
- test
- build
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
merge-multiple: true
- name: Create checksums
shell: bash
run: |
cd dist
sha256sum devsite-* > SHA256SUMS
sha256sum --check SHA256SUMS
- name: Attest checksum manifest
if: github.event.repository.private == false
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
with:
subject-path: dist/SHA256SUMS
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
gh release create "$GITHUB_REF_NAME" dist/* \
--verify-tag \
--latest \
--fail-on-no-commits \
--title "dev.site $GITHUB_REF_NAME" \
--notes "$(cat .github/release-intro.md)" \
--generate-notes
update-homebrew:
name: Update Homebrew tap
needs: release
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout release source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download Apple Silicon archive
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: aarch64-apple-darwin
path: dist
- name: Checkout Homebrew tap
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: FelineStateMachine/homebrew-tap
path: homebrew-tap
ssh-key: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
- name: Render stable formula
shell: bash
run: |
version="${GITHUB_REF_NAME#v}"
archive="dist/devsite-${GITHUB_REF_NAME}-aarch64-apple-darwin.tar.gz"
sha256="$(sha256sum "$archive" | cut -d ' ' -f 1)"
sed \
-e "s/@VERSION@/$version/g" \
-e "s/@SHA256@/$sha256/g" \
.github/homebrew/devsite.rb.in > homebrew-tap/Formula/devsite.rb
ruby -c homebrew-tap/Formula/devsite.rb
- name: Push formula update
shell: bash
run: |
git -C homebrew-tap config user.name "github-actions[bot]"
git -C homebrew-tap config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git -C homebrew-tap add Formula/devsite.rb
git -C homebrew-tap commit -m "devsite $GITHUB_REF_NAME"
git -C homebrew-tap push