Skip to content

feat: dockerhub release #11

feat: dockerhub release

feat: dockerhub release #11

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --locked --all-targets
build:
needs: test
strategy:
fail-fast: false
matrix:
include:
## macOS: aarch64, x86_64
- target: aarch64-apple-darwin
os: macos-latest
bin_ext: ""
- target: x86_64-apple-darwin
os: macos-latest
bin_ext: ""
## Linux:
## Linux: aarch64, x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
bin_ext: ""
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
bin_ext: ""
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
bin_ext: ""
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
bin_ext: ""
## Windows: x86_64
- target: x86_64-pc-windows-msvc
os: windows-latest
bin_ext: ".exe"
- target: x86_64-pc-windows-gnu
os: windows-latest
bin_ext: ".exe"
# FreeBSD: x86_64
- target: x86_64-unknown-freebsd
os: ubuntu-latest
bin_ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: startsWith(matrix.os, 'ubuntu')
uses: taiki-e/install-action@v2
with:
tool: cross
- uses: Swatinem/rust-cache@v2
- name: Build (Ubuntu via cross)
if: startsWith(matrix.os, 'ubuntu')
run: cross build --release --locked --target ${{ matrix.target }}
- name: Build (non-Ubuntu)
if: "!startsWith(matrix.os, 'ubuntu')"
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Prepare release binary
id: prepare
shell: bash
run: |
mkdir -p dist
asset="diff-coverage-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.bin_ext }}"
cp "target/${{ matrix.target }}/release/diff-coverage${{ matrix.bin_ext }}" "dist/$asset"
echo "asset=dist/$asset" >> "$GITHUB_OUTPUT"
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
${{ steps.prepare.outputs.asset }}
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}