release: v0.9.22 #59
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| info: | |
| name: Gather info | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract version | |
| id: version | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| version=$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2) | |
| if [[ -z "$version" ]]; then | |
| echo "Error: no version found in Cargo.toml" | |
| exit 1 | |
| fi | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "Found version: $version" | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: linux-x64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - name: macos-x64 | |
| os: macos-14 | |
| target: x86_64-apple-darwin | |
| - name: macos-arm64 | |
| os: macos-15 | |
| target: aarch64-apple-darwin | |
| - name: windows-x64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| name: Build ${{ matrix.name }} | |
| needs: info | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| version: ${{ needs.info.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| rustup target add ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }}-v2 | |
| - name: Build binary | |
| run: cargo build --release --locked --target ${{ matrix.target }} --all-features | |
| - name: Package (Unix) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| bin="target/${{ matrix.target }}/release/codanna" | |
| dst="codanna-${{ env.version }}-${{ matrix.name }}" | |
| mkdir "$dst" | |
| cp "$bin" "$dst/" | |
| cp LICENSE "$dst/" | |
| tar -cJf "$dst.tar.xz" "$dst" | |
| # Generate checksums (macOS uses shasum, Linux uses sha256sum) | |
| if command -v sha256sum > /dev/null; then | |
| sha256sum "$dst.tar.xz" | cut -d' ' -f1 > "$dst.tar.xz.sha256" | |
| sha512sum "$dst.tar.xz" | cut -d' ' -f1 > "$dst.tar.xz.sha512" | |
| else | |
| shasum -a 256 "$dst.tar.xz" | cut -d' ' -f1 > "$dst.tar.xz.sha256" | |
| shasum -a 512 "$dst.tar.xz" | cut -d' ' -f1 > "$dst.tar.xz.sha512" | |
| fi | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| bin="target/${{ matrix.target }}/release/codanna.exe" | |
| dst="codanna-${{ env.version }}-${{ matrix.name }}" | |
| mkdir "$dst" | |
| cp "$bin" "$dst/" | |
| cp LICENSE "$dst/" | |
| 7z a "$dst.zip" "$dst" | |
| # Generate checksums | |
| sha256sum "$dst.zip" | cut -d' ' -f1 > "$dst.zip.sha256" | |
| sha512sum "$dst.zip" | cut -d' ' -f1 > "$dst.zip.sha512" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.name }} | |
| retention-days: 1 | |
| path: | | |
| codanna-*.tar.xz | |
| codanna-*.zip | |
| *.sha256 | |
| *.sha512 | |
| upload: | |
| needs: [build, info] | |
| name: Create release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| merge-multiple: true | |
| - name: Generate bulk checksums | |
| run: | | |
| shasum -a 256 codanna-* | tee SHA256SUMS | |
| shasum -a 512 codanna-* | tee SHA512SUMS | |
| - name: Create manifest | |
| run: | | |
| version="${{ needs.info.outputs.version }}" | |
| repo="${{ github.repository }}" | |
| { | |
| echo "{" | |
| echo " \"version\": \"$version\"," | |
| echo " \"artifacts\": [" | |
| first=true | |
| for file in codanna-*.tar.xz codanna-*.zip; do | |
| [[ -f "$file" ]] || continue | |
| # Extract platform from filename: codanna-0.8.9-linux-x64.tar.xz -> linux-x64 | |
| platform=$(echo "$file" | sed -n 's/codanna-[^-]*-\([^.]*\)\..*/\1/p') | |
| sha256=$(shasum -a 256 "$file" | cut -d' ' -f1) | |
| url="https://github.com/${repo}/releases/download/v${version}/${file}" | |
| [[ "$first" == "false" ]] && echo "," | |
| first=false | |
| echo " {" | |
| echo " \"name\": \"$file\"," | |
| echo " \"url\": \"$url\"," | |
| echo " \"sha256\": \"$sha256\"," | |
| echo " \"platform\": \"$platform\"" | |
| echo " }" | |
| done | |
| echo " ]" | |
| echo "}" | |
| } > dist-manifest.json | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.info.outputs.version }} | |
| name: v${{ needs.info.outputs.version }} | |
| draft: true | |
| files: | | |
| dist-manifest.json | |
| codanna-*.tar.xz | |
| codanna-*.zip | |
| *SUMS | |
| *.sha256 | |
| *.sha512 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |