updated github release #1
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*" | |
| permissions: | |
| contents: write # create GH release + upload assets | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| - x86_64-apple-darwin | |
| - aarch64-apple-darwin | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross | |
| - name: Build | |
| run: cross build --release --target ${{ matrix.target }} | |
| - name: Package | |
| shell: bash | |
| run: | | |
| set -eux | |
| VERSION="${GITHUB_REF_NAME}" # e.g. v0.1.1 | |
| TARGET="${{ matrix.target }}" | |
| OUTDIR="dist" | |
| mkdir -p "$OUTDIR" | |
| BIN="target/$TARGET/release/canine" | |
| PKG="canine_${VERSION}_${TARGET}" | |
| mkdir -p "$PKG" | |
| cp "$BIN" "$PKG/" | |
| tar -czf "$OUTDIR/$PKG.tar.gz" "$PKG" | |
| - name: Upload artifacts to workflow run | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.target }} | |
| path: dist/*.tar.gz | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Flatten dist | |
| shell: bash | |
| run: | | |
| set -eux | |
| mkdir -p out | |
| find dist -name "*.tar.gz" -exec cp {} out/ \; | |
| (cd out && shasum -a 256 *.tar.gz > SHA256SUMS) | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| out/*.tar.gz | |
| out/SHA256SUMS | |