name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
packages: write
jobs:
create-release:
runs-on: ubuntu-22.04
steps:
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
publish-crate:
needs: create-release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: cargo publish --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
needs: create-release
strategy:
matrix:
include:
- os: ubuntu-22.04
artifact: murr-linux-x64
binary: murr
- os: ubuntu-22.04-arm64
artifact: murr-linux-arm64
binary: murr
- os: macos-14
artifact: murr-macos-arm64
binary: murr
- os: windows-2022
artifact: murr-windows-x64.exe
binary: murr.exe
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
steps:
- uses: actions/checkout@v6
- name: Install build-essential and clang (arm64)
if: matrix.os == 'ubuntu-22.04-arm64'
run: sudo apt-get update && sudo apt-get install -y build-essential clang libclang-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build release binary
run: cargo build --release
- name: Prepare release artifact
shell: bash
run: cp target/release/${{ matrix.binary }} ${{ matrix.artifact }}
- name: Upload release artifact
uses: softprops/action-gh-release@v3
with:
files: ${{ matrix.artifact }}
- name: Upload binary for Docker build
if: startsWith(matrix.artifact, 'murr-linux-')
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: target/release/${{ matrix.binary }}
docker:
needs: release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Download linux-x64 binary
uses: actions/download-artifact@v8
with:
name: murr-linux-x64
path: docker-bin/linux/amd64
- name: Download linux-arm64 binary
uses: actions/download-artifact@v8
with:
name: murr-linux-arm64
path: docker-bin/linux/arm64
- name: Prepare binaries
run: chmod +x docker-bin/linux/amd64/murr docker-bin/linux/arm64/murr
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}