Skip to content

Release 0.1.0-rc.3

Release 0.1.0-rc.3 #4

Workflow file for this run

name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
BIN_NAME: ${{ github.event.repository.name }}
REGISTRY: ghcr.io
permissions:
contents: write
packages: write
jobs:
prepare:
name: Prepare Environment
runs-on: ubuntu-latest
outputs:
is_prerelease: ${{ steps.eval.outputs.is_prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Evaluate Tags
id: eval
run: |
if [[ "${GITHUB_REF#refs/tags/}" == *-* ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
draft: true
build:
name: Build ${{ matrix.target }}
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cpu: x86-64-v3
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cpu: x86-64-v3
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
cpu: neoverse-n1
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
cpu: neoverse-n1
- target: x86_64-apple-darwin
os: macos-15-intel
cpu: x86-64-v3
- target: aarch64-apple-darwin
os: macos-latest
cpu: apple-m1
- target: x86_64-pc-windows-msvc
os: windows-latest
cpu: x86-64-v3
- target: aarch64-pc-windows-msvc
os: windows-11-arm
cpu: cortex-a76
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install musl-tools
if: contains(matrix.target, '-musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build and Upload Binary
uses: taiki-e/upload-rust-binary-action@v1
env:
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}"
with:
bin: ${{ env.BIN_NAME }}
target: ${{ matrix.target }}
build-tool: cargo
locked: true
include: LICENSE,README.md
archive: $bin-$target
- name: Upload Binary for Docker
if: contains(matrix.target, 'linux-musl')
uses: actions/upload-artifact@v7
with:
name: binary-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ env.BIN_NAME }}
retention-days: 1
publish:
name: Publish Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Publish Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit ${{ github.ref_name }} --draft=false
docker:
name: Docker Push
needs:
- prepare
- build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download amd64 Binary
uses: actions/download-artifact@v8
with:
name: binary-x86_64-unknown-linux-musl
path: bin/amd64
- name: Download arm64 Binary
uses: actions/download-artifact@v8
with:
name: binary-aarch64-unknown-linux-musl
path: bin/arm64
- name: Make Binaries Executable
run: chmod +x -R bin/
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log In to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ needs.prepare.outputs.is_prerelease != 'true' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ needs.prepare.outputs.is_prerelease != 'true' }}
- name: Build and Push Image
uses: docker/build-push-action@v7
with:
context: .
file: .github/workflows/Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}