name: Release
on:
push:
tags: ["v*"]
permissions: {}
jobs:
build:
name: Build scrub (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
permissions:
contents: read
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
artifact: scrub-linux-x86_64
- target: x86_64-apple-darwin
runner: macos-latest
artifact: scrub-macos-x86_64
- target: aarch64-apple-darwin
runner: macos-latest
artifact: scrub-macos-aarch64
- target: x86_64-pc-windows-msvc
runner: windows-latest
artifact: scrub-windows-x86_64
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 with:
target: ${{ matrix.target }}
- name: Build scrub (release)
run: cargo build --release --bin scrub --target ${{ matrix.target }}
- name: Package binary (Unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar czf ${{ matrix.artifact }}.tar.gz scrub
sha256sum ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.tar.gz.sha256
- name: Package binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
Compress-Archive -Path scrub.exe -DestinationPath ${{ matrix.artifact }}.zip
(Get-FileHash ${{ matrix.artifact }}.zip -Algorithm SHA256).Hash.ToLower() + " ${{ matrix.artifact }}.zip" | Out-File -Encoding ascii ${{ matrix.artifact }}.zip.sha256
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: ${{ matrix.artifact }}
path: |
target/${{ matrix.target }}/release/${{ matrix.artifact }}.tar.gz
target/${{ matrix.target }}/release/${{ matrix.artifact }}.tar.gz.sha256
target/${{ matrix.target }}/release/${{ matrix.artifact }}.zip
target/${{ matrix.target }}/release/${{ matrix.artifact }}.zip.sha256
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with:
path: artifacts
merge-multiple: true
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--generate-notes \
artifacts/*