1name: Release23on:4 push:5 tags:6 - "v*.*.*"78permissions:9 contents: read1011jobs:12 validate:13 name: Validate tag14 runs-on: ubuntu-24.0415 steps:16 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.11718 - name: Match tag to workspace version19 shell: bash20 run: |21 if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then22 echo "expected a release tag like v0.2.0, got $GITHUB_REF_NAME" >&223 exit 124 fi2526 tag_version="${GITHUB_REF_NAME#v}"27 workspace_version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n 1)"28 if [[ "$tag_version" != "$workspace_version" ]]; then29 echo "tag $GITHUB_REF_NAME does not match workspace version $workspace_version" >&230 exit 131 fi3233 plugin_version="$(node -p "require('./plugins/devsite-access/.codex-plugin/plugin.json').version")"34 if [[ "$tag_version" != "$plugin_version" ]]; then35 echo "tag $GITHUB_REF_NAME does not match devsite-access plugin version $plugin_version" >&236 exit 137 fi3839 test:40 name: Test workspace41 needs: validate42 runs-on: ubuntu-24.0443 steps:44 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.14546 - name: Install stable Rust47 run: |48 rustup update stable49 rustup default stable5051 - name: Install Node.js52 uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.1.053 with:54 node-version: 2455 cache: npm5657 - name: Install web dependencies58 run: |59 npm ci60 npx playwright install --with-deps chromium6162 - name: Test63 run: |64 cargo test --workspace --locked65 npm run check:web66 npm run test:web6768 build:69 name: Build ${{ matrix.target }}70 needs: validate71 strategy:72 fail-fast: false73 matrix:74 include:75 - runner: macos-1576 target: aarch64-apple-darwin77 - runner: ubuntu-22.0478 target: x86_64-unknown-linux-gnu79 - runner: ubuntu-22.04-arm80 target: aarch64-unknown-linux-gnu81 - runner: windows-202582 target: x86_64-pc-windows-msvc83 runs-on: ${{ matrix.runner }}84 permissions:85 contents: read86 id-token: write87 attestations: write88 steps:89 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.19091 - name: Install stable Rust92 shell: bash93 run: |94 rustup update stable95 rustup default stable96 rustup target add "${{ matrix.target }}"9798 - name: Build CLI99 shell: bash100 run: cargo build --locked --release -p devsite-cli --target "${{ matrix.target }}"101102 - name: Smoke test CLI103 shell: bash104 run: |105 binary="target/${{ matrix.target }}/release/devsite"106 if [[ "${{ runner.os }}" == "Windows" ]]; then107 binary="$binary.exe"108 fi109 "$binary" --version | grep -Fx "devsite ${GITHUB_REF_NAME#v}"110111 - name: Package archive112 if: runner.os != 'Windows'113 shell: bash114 run: |115 name="devsite-${GITHUB_REF_NAME}-${{ matrix.target }}"116 mkdir -p "dist/$name/plugins"117 install -m 0755 "target/${{ matrix.target }}/release/devsite" "dist/$name/devsite"118 cp README.md LICENSE "dist/$name/"119 cp -R docs skills "dist/$name/"120 cp -R plugins/devsite-access "dist/$name/plugins/"121 tar -C dist -czf "dist/$name.tar.gz" "$name"122 rm -rf "dist/$name"123124 - name: Package archive125 if: runner.os == 'Windows'126 shell: pwsh127 run: |128 $name = "devsite-$env:GITHUB_REF_NAME-${{ matrix.target }}"129 New-Item -ItemType Directory -Path "dist/$name" | Out-Null130 Copy-Item "target/${{ matrix.target }}/release/devsite.exe" "dist/$name/devsite.exe"131 Copy-Item README.md, LICENSE "dist/$name/"132 Copy-Item docs, skills -Destination "dist/$name" -Recurse133 New-Item -ItemType Directory -Path "dist/$name/plugins" | Out-Null134 Copy-Item plugins/devsite-access -Destination "dist/$name/plugins" -Recurse135 Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip"136 Remove-Item -Recurse "dist/$name"137138 - name: Attest archive provenance139 if: github.event.repository.private == false140 uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4141 with:142 subject-path: dist/*143144 - name: Upload archive145 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1146 with:147 name: ${{ matrix.target }}148 path: dist/*149 if-no-files-found: error150151 release:152 name: Publish release153 needs:154 - test155 - build156 runs-on: ubuntu-24.04157 permissions:158 contents: write159 id-token: write160 attestations: write161 steps:162 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1163164 - name: Download archives165 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1166 with:167 path: dist168 merge-multiple: true169170 - name: Create checksums171 shell: bash172 run: |173 cd dist174 sha256sum devsite-* > SHA256SUMS175 sha256sum --check SHA256SUMS176177 - name: Attest checksum manifest178 if: github.event.repository.private == false179 uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4180 with:181 subject-path: dist/SHA256SUMS182183 - name: Publish GitHub release184 env:185 GH_TOKEN: ${{ github.token }}186 shell: bash187 run: |188 gh release create "$GITHUB_REF_NAME" dist/* \189 --verify-tag \190 --latest \191 --fail-on-no-commits \192 --title "dev.site $GITHUB_REF_NAME" \193 --notes "$(cat .github/release-intro.md)" \194 --generate-notes195196 update-homebrew:197 name: Update Homebrew tap198 needs: release199 runs-on: ubuntu-24.04200 permissions:201 contents: read202 steps:203 - name: Checkout release source204 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1205206 - name: Download Apple Silicon archive207 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1208 with:209 name: aarch64-apple-darwin210 path: dist211212 - name: Checkout Homebrew tap213 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1214 with:215 repository: FelineStateMachine/homebrew-tap216 path: homebrew-tap217 ssh-key: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}218219 - name: Render stable formula220 shell: bash221 run: |222 version="${GITHUB_REF_NAME#v}"223 archive="dist/devsite-${GITHUB_REF_NAME}-aarch64-apple-darwin.tar.gz"224 sha256="$(sha256sum "$archive" | cut -d ' ' -f 1)"225226 sed \227 -e "s/@VERSION@/$version/g" \228 -e "s/@SHA256@/$sha256/g" \229 .github/homebrew/devsite.rb.in > homebrew-tap/Formula/devsite.rb230 ruby -c homebrew-tap/Formula/devsite.rb231232 - name: Push formula update233 shell: bash234 run: |235 git -C homebrew-tap config user.name "github-actions[bot]"236 git -C homebrew-tap config user.email "41898282+github-actions[bot]@users.noreply.github.com"237 git -C homebrew-tap add Formula/devsite.rb238 git -C homebrew-tap commit -m "devsite $GITHUB_REF_NAME"239 git -C homebrew-tap push