Release v0.2.1 #6
Workflow file for this run
This file contains 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
# crates.io is done manually for now. | |
name: "Release" | |
run-name: "Release ${{ github.ref_name }}" | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
checks: | |
name: "Checks" | |
strategy: | |
matrix: | |
os: ["windows-latest", "macos-latest", "ubuntu-latest"] | |
fail-fast: true | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Rust Toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
cache: false | |
- name: Build Project | |
run: cargo build --all | |
- name: Run Tests | |
run: cargo test --all | |
container: | |
name: "Container Image" | |
runs-on: ubuntu-latest | |
needs: ["checks"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
logout: true | |
- name: Extract Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & Publish Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
github: | |
name: "GitHub Release" | |
needs: ["checks", "container"] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Determine if this is a pre-release | |
id: prerelease | |
run: | | |
# If the tag ends with -beta.* then it is a prerelease. | |
if [[ "${{ github.ref }}" =~ ^refs/tags/.*-beta\..* ]]; then | |
echo "is-prerelease=true" >> $GITHUB_OUTPUT | |
# If the tag ends with -rc.* then it is a prerelease. | |
elif [[ "${{ github.ref }}" =~ ^refs/tags/.*-rc\..* ]]; then | |
echo "is-prerelease=true" >> $GITHUB_OUTPUT | |
# Otherwise it is a release. | |
else | |
echo "is-prerelease=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
prerelease: ${{ steps.prelease.outputs.is-prerelease }} | |
append_body: true | |
generate_release_notes: true |