fix: release ci #22
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to release (e.g. v0.5.0)" | |
| required: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BINARY_NAME: diffmind | |
| jobs: | |
| # ─── Build cross-platform binaries ───────────────────────────────────────── | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.runner }} | |
| if: github.repository_owner == 'thinkgrid-labs' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| archive: tar.gz | |
| cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| archive: tar.gz | |
| cross: true | |
| - target: x86_64-apple-darwin | |
| runner: macos-latest | |
| archive: tar.gz | |
| cross: false | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| archive: tar.gz | |
| cross: false | |
| - target: x86_64-pc-windows-msvc | |
| runner: windows-latest | |
| archive: zip | |
| cross: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust (stable) | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross (aarch64-linux) | |
| if: matrix.cross == true | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross | |
| - name: Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: release-${{ matrix.target }} | |
| - name: Build (native) | |
| if: matrix.cross == false | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Build (cross) | |
| if: matrix.cross == true | |
| run: cross build --release --target ${{ matrix.target }} | |
| # ── Package ────────────────────────────────────────────────────────── | |
| - name: Package (tar.gz — Unix) | |
| if: matrix.archive == 'tar.gz' | |
| shell: bash | |
| run: | | |
| ASSET="${{ env.BINARY_NAME }}-${{ matrix.target }}" | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} dist/ | |
| cp README.md LICENSE dist/ | |
| tar -czf "${ASSET}.tar.gz" -C dist . | |
| echo "ASSET=${ASSET}.tar.gz" >> $GITHUB_ENV | |
| - name: Package (zip — Windows) | |
| if: matrix.archive == 'zip' | |
| shell: pwsh | |
| run: | | |
| $asset = "${{ env.BINARY_NAME }}-${{ matrix.target }}" | |
| New-Item -ItemType Directory -Force dist | Out-Null | |
| Copy-Item "target\${{ matrix.target }}\release\${{ env.BINARY_NAME }}.exe" dist\ | |
| Copy-Item README.md dist\ | |
| Copy-Item LICENSE dist\ | |
| Compress-Archive -Path dist\* -DestinationPath "${asset}.zip" | |
| "ASSET=${asset}.zip" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-${{ matrix.target }} | |
| path: ${{ env.ASSET }} | |
| retention-days: 1 | |
| # ─── Create GitHub Release ───────────────────────────────────────────────── | |
| release: | |
| name: Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.repository_owner == 'thinkgrid-labs' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Generate checksums (SHA-256) | |
| run: | | |
| cd artifacts | |
| sha256sum * > checksums.txt | |
| cat checksums.txt | |
| - name: Extract release notes from tag | |
| id: notes | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: diffmind ${{ steps.notes.outputs.tag }} | |
| tag_name: ${{ steps.notes.outputs.tag }} | |
| draft: false | |
| prerelease: ${{ contains(steps.notes.outputs.tag, '-') }} | |
| generate_release_notes: true | |
| files: | | |
| artifacts/* | |
| body: | | |
| ## Installation | |
| Download the binary for your platform below, then: | |
| **Linux / macOS** | |
| ```bash | |
| tar -xzf diffmind-<target>.tar.gz | |
| sudo mv diffmind /usr/local/bin/ | |
| diffmind download # one-time model setup | |
| ``` | |
| **Windows** | |
| Extract the `.zip`, place `diffmind.exe` somewhere on your `PATH`, then run: | |
| ```powershell | |
| diffmind download | |
| ``` | |
| **Build from source** | |
| ```bash | |
| cargo install diffmind | |
| ``` | |
| ## SHA-256 checksums | |
| See `checksums.txt` in the release assets. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |