Create artifacts #31
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: Create artifacts | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
inputs: | |
linux: | |
description: "Create artifacts for Linux" | |
required: false | |
type: boolean | |
default: true | |
windows: | |
description: "Create artifacts for Windows" | |
required: false | |
type: boolean | |
default: true | |
macos: | |
description: "Create artifacts for macOS" | |
required: false | |
type: boolean | |
default: true | |
permissions: | |
contents: read | |
jobs: | |
create-linux-artifacts: | |
name: Create Linux artifacts | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.linux == true || github.event_name == 'push'}} | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker | |
uses: docker/setup-docker-action@v4 | |
with: | |
daemon-config: | | |
{ | |
"debug": true, | |
"features": { | |
"containerd-snapshotter": true | |
} | |
} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./Dockerfile.artifacts | |
context: ./ | |
platforms: linux/amd64,linux/arm64 | |
load: true | |
tags: fediproto-sync-artifacts:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Extract compiled artifacts | |
shell: bash | |
run: | | |
mkdir -p ${{ github.workspace }}/artifacts; | |
docker run --volume "./artifacts:/artifacts" --platform "linux/amd64" --rm "fediproto-sync-artifacts:latest" /bin/bash -c "cp -r /tmp/fediproto-sync/** /artifacts"; | |
docker run --volume "./artifacts:/artifacts" --platform "linux/arm64" --rm "fediproto-sync-artifacts:latest" /bin/bash -c "cp -r /tmp/fediproto-sync/** /artifacts"; | |
- name: Create artifact (Linux - x64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_linux-amd64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/linux_amd64/**/* | |
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 | |
create-windows-artifacts: | |
name: Create Windows artifacts | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.windows == true || github.event_name == 'push' }} | |
runs-on: windows-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: pwsh | |
run: | | |
rustup target add x86_64-pc-windows-msvc; | |
# rustup target add aarch64-pc-windows-msvc; | |
- name: Build | |
shell: pwsh | |
env: | |
FEDIPROTOSYNC_INCLUDE_COMMIT_HASH: "true" | |
FEDIPROTOSYNC_UPDATE_MANIFEST_VERSION: "true" | |
run: | | |
cargo build --release --target "x86_64-pc-windows-msvc"; | |
# cargo build --release --target "aarch64-pc-windows-msvc"; | |
$null = New-Item -Path "${{ github.workspace }}/artifacts" -ItemType "Directory"; | |
$null = New-Item -Path "${{ github.workspace }}/artifacts/windows_amd64" -ItemType "Directory"; | |
# $null = New-Item -Path "${{ github.workspace }}/artifacts/windows_arm64" -ItemType "Directory"; | |
Copy-Item -Path "${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/fediproto-sync.exe" -Destination "${{ github.workspace }}/artifacts/windows_amd64/fediproto-sync.exe"; | |
# Copy-Item -Path "${{ github.workspace }}/target/aarch64-pc-windows-msvc/release/fediproto-sync.exe" -Destination "${{ github.workspace }}/artifacts/windows_arm64/fediproto-sync.exe"; | |
- name: Create artifact (Windows - x64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_windows-amd64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/windows_amd64/**/* | |
if-no-files-found: error | |
# - name: Create artifact (Windows - arm64) | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: "fediproto-sync_windows-arm64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
# path: ${{ github.workspace }}/artifacts/windows_arm64/**/* | |
# if-no-files-found: error | |
create-macos-artifacts: | |
name: Create macOS artifacts | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.macos == true || github.event_name == 'push' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ "macos-14", "macos-13" ] | |
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 (macOS - x64) | |
if: ${{ matrix.os == 'macos-13' }} | |
shell: bash | |
run: | | |
rustup target add x86_64-apple-darwin; | |
- name: Install targets (macOS - arm64) | |
if: ${{ matrix.os == 'macos-14' }} | |
shell: bash | |
run: | | |
rustup target add aarch64-apple-darwin; | |
- name: Build (macOS - x64) | |
if: ${{ matrix.os == 'macos-13' }} | |
shell: bash | |
env: | |
FEDIPROTOSYNC_INCLUDE_COMMIT_HASH: "true" | |
FEDIPROTOSYNC_UPDATE_MANIFEST_VERSION: "true" | |
run: | | |
cargo build --release --target "x86_64-apple-darwin"; | |
mkdir -p "${{ github.workspace }}/artifacts/macos_amd64"; | |
cp "${{ github.workspace }}/target/x86_64-apple-darwin/release/fediproto-sync" "${{ github.workspace }}/artifacts/macos_amd64/fediproto-sync"; | |
- name: Build (macOS - arm64) | |
if: ${{ matrix.os == 'macos-14' }} | |
shell: bash | |
env: | |
FEDIPROTOSYNC_INCLUDE_COMMIT_HASH: "true" | |
FEDIPROTOSYNC_UPDATE_MANIFEST_VERSION: "true" | |
run: | | |
cargo build --release --target "aarch64-apple-darwin"; | |
mkdir -p "${{ github.workspace }}/artifacts/macos_arm64"; | |
cp "${{ github.workspace }}/target/aarch64-apple-darwin/release/fediproto-sync" "${{ github.workspace }}/artifacts/macos_arm64/fediproto-sync"; | |
- name: Create artifact (macOS - x64) | |
if: ${{ matrix.os == 'macos-13' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_macos-amd64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/macos_amd64/**/* | |
if-no-files-found: error | |
- name: Create artifact (macOS - arm64) | |
if: ${{ matrix.os == 'macos-14' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "fediproto-sync_macos-arm64_${{ github.ref_type == 'tag' && github.ref_name || github.sha }}" | |
path: ${{ github.workspace }}/artifacts/macos_arm64/**/* | |
if-no-files-found: error |