Skip to content

Initial commit

Initial commit #4

Workflow file for this run

name: Dev Release
on:
push:
branches:
- "master"
tags-ignore:
- "**"
env:
BIN_NAME: ${{ github.event.repository.name }}
REGISTRY: ghcr.io
permissions:
contents: write
packages: write
jobs:
build-dev:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
install_deps: "false"
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
install_deps: sudo apt-get update && sudo apt-get install -y musl-tools
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
install_deps: "false"
- target: x86_64-apple-darwin
os: macos-15-intel
install_deps: "false"
- target: aarch64-apple-darwin
os: macos-latest
install_deps: "false"
- target: x86_64-pc-windows-msvc
os: windows-latest
install_deps: "false"
- target: aarch64-pc-windows-msvc
os: windows-11-arm
install_deps: "false"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install System Dependencies
if: matrix.install_deps != 'false'
run: ${{ matrix.install_deps }}
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cargo-edit
uses: taiki-e/install-action@v2
with:
tool: cargo-edit
- name: Set Dev Version
shell: bash
run: |
BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2)
SHORT_SHA=$(git rev-parse --short HEAD)
cargo set-version "${BASE_VERSION}-dev.${SHORT_SHA}"
- name: Build Binary
run: cargo build --locked --release --target ${{ matrix.target }}
- name: Package Binary
shell: bash
run: |
mkdir dist
cp LICENSE dist/
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" dist/
cd dist
7z a "../${{ env.BIN_NAME }}-${{ matrix.target }}.zip" "${{ env.BIN_NAME }}.exe" LICENSE
else
cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" dist/
cd dist
tar -czf "../${{ env.BIN_NAME }}-${{ matrix.target }}.tar.gz" "${{ env.BIN_NAME }}" LICENSE
fi
- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: binary-${{ matrix.target }}
path: ${{ env.BIN_NAME }}-${{ matrix.target }}*
retention-days: 1
release-dev:
name: Update Dev Release
needs: build-dev
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
merge-multiple: true
- name: Update Pre-Release
uses: softprops/action-gh-release@v2
with:
tag_name: dev
name: Development Build
body: "Latest development build from master. Commit: ${{ github.sha }}"
prerelease: true
files: artifacts/*
make_latest: false
docker-dev:
name: Push Dev Docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install cargo-edit
uses: taiki-e/install-action@v2
with:
tool: cargo-edit
- name: Set Dev Version
shell: bash
run: |
BASE_VERSION=$(grep -m1 'version = "' Cargo.toml | cut -d '"' -f 2)
SHORT_SHA=$(git rev-parse --short HEAD)
cargo set-version "${BASE_VERSION}-dev.${SHORT_SHA}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository }}:dev
cache-from: type=gha
cache-to: type=gha,mode=max