Create artifacts #8
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: Create artifacts | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
create-linux-artifacts: | |
name: Create Linux artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
- name: Install targets | |
shell: bash | |
run: | | |
rustup target add x86_64-unknown-linux-gnu | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install cargo-binstall | |
uses: cargo-bins/cargo-binstall@main | |
- name: Install cargo cross | |
shell: bash | |
run: | | |
cargo binstall --no-confirm cross | |
- name: Build (Linux - x64) | |
shell: bash | |
run: | | |
FEDIPROTOSYNC_INCLUDE_COMMIT_HASH="${{ github.event_name == 'workflow_dispatch' || 'false' }}" \ | |
FEDIPROTOSYNC_UPDATE_MANIFEST_VERSION="true" \ | |
$HOME/.cargo/bin/cross build --target "x86_64-unknown-linux-gnu" --release; | |
mkdir -p "${{ github.workspace }}/artifacts/linux-x64"; | |
cp "${{ github.workspace }}/target/x86_64-unknown-linux-gnu/release/fediproto-sync" "${{ github.workspace }}/artifacts/linux-x64/fediproto-sync"; | |
- name: Build (Linux - arm64) | |
shell: bash | |
run: | | |
FEDIPROTOSYNC_INCLUDE_COMMIT_HASH="${{ github.event_name == 'workflow_dispatch' || 'false' }}" \ | |
FEDIPROTOSYNC_UPDATE_MANIFEST_VERSION="true" \ | |
$HOME/.cargo/bin/cross build --target "aarch64-unknown-linux-gnu" --release; | |
mkdir -p "${{ github.workspace }}/artifacts/linux-arm64"; | |
cp "${{ github.workspace }}/target/aarch64-unknown-linux-gnu/release/fediproto-sync" "${{ github.workspace }}/artifacts/linux-arm64/fediproto-sync"; | |
- name: Create artifact (Linux - x64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_linux-x64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/linux-x64/**/* | |
if-no-files-found: error | |
- name: Create artifact (Linux - arm64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_linux-arm64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/linux-arm64/**/* | |
if-no-files-found: error |