Support ARM64 Linux MUSL target in release builds #58
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
name: release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write # Needed for the actual release | |
packages: read # Needed for docker access, etc. | |
jobs: | |
build: | |
name: build / ${{ matrix.os }} / ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Native runners - no need for cross compilation | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: false | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
cross: false | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
cross: false | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
cross: false | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: true | |
# Cross compilation needed | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
cross: true | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
cross: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- uses: Swatinem/[email protected] | |
with: | |
key: ${{ matrix.target }} | |
- uses: taiki-e/install-action@v2 | |
if: matrix.cross | |
with: | |
tool: cross | |
- name: build | |
shell: bash | |
run: | | |
CARGO_COMMAND=${{ matrix.cross && 'cross' || 'cargo' }} | |
$CARGO_COMMAND build --release --target ${{ matrix.target }} | |
- name: prepare:unix | |
if: runner.os != 'Windows' | |
shell: bash | |
run: | | |
TARGET_DIR="target/${{ matrix.target }}/release" | |
ARTIFACT_NAME="circe-${{ matrix.target }}" | |
mkdir -p "$ARTIFACT_NAME" | |
cp "$TARGET_DIR/circe" "$ARTIFACT_NAME/" | |
cp README.md LICENSE "$ARTIFACT_NAME/" | |
tar -czf "$ARTIFACT_NAME.tar.gz" "$ARTIFACT_NAME" | |
- name: prepare:windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$TARGET_DIR = "target/${{ matrix.target }}/release" | |
$ARTIFACT_NAME = "circe-${{ matrix.target }}" | |
mkdir $ARTIFACT_NAME | |
Copy-Item "$TARGET_DIR/circe.exe" "$ARTIFACT_NAME/" | |
Copy-Item README.md "$ARTIFACT_NAME/" | |
Copy-Item LICENSE "$ARTIFACT_NAME/" | |
Compress-Archive -Path "$ARTIFACT_NAME/*" -DestinationPath "$ARTIFACT_NAME.zip" | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: circe-${{ matrix.target }} | |
path: | | |
circe-${{ matrix.target }}.tar.gz | |
circe-${{ matrix.target }}.zip | |
if-no-files-found: warn | |
# Create checksums for all artifacts | |
create-checksums: | |
name: checksums | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- name: generate | |
run: | | |
cd artifacts | |
find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec sha256sum {} \; > checksums.txt | |
cat checksums.txt | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: checksums | |
path: artifacts/checksums.txt | |
release: | |
name: push | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [build, create-checksums] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for git-cliff to work properly | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/[email protected] | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: git-cliff | |
- name: version | |
id: get_version | |
run: | | |
if [[ "${{ github.event_name }}" == "push" && "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
else | |
echo "VERSION=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
fi | |
- name: changelog | |
id: changelog | |
run: | | |
VERSION=$(echo "${{ steps.get_version.outputs.VERSION }}" | sed 's/^v//') | |
# Generate changelog for this specific version | |
git cliff --current --strip header > version_changelog.txt | |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
cat version_changelog.txt >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: create | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/*.tar.gz | |
artifacts/*.zip | |
artifacts/checksums.txt | |
body: | | |
## Changes in ${{ steps.get_version.outputs.VERSION }} | |
${{ steps.changelog.outputs.CHANGELOG }} | |
## Installation | |
Download the appropriate binary for your system and architecture: | |
| Platform | Architecture | Download | | |
| -------- | ------------ | -------- | | |
| macOS | x86_64 | [circe-x86_64-apple-darwin.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-x86_64-apple-darwin.tar.gz) | | |
| macOS | arm64 | [circe-aarch64-apple-darwin.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-aarch64-apple-darwin.tar.gz) | | |
| Linux | x86_64 | [circe-x86_64-unknown-linux-gnu.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-x86_64-unknown-linux-gnu.tar.gz) | | |
| Linux | arm64 | [circe-aarch64-unknown-linux-gnu.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-aarch64-unknown-linux-gnu.tar.gz) | | |
| Linux | x86_64 (musl) | [circe-x86_64-unknown-linux-musl.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-x86_64-unknown-linux-musl.tar.gz) | | |
| Linux | arm64 (musl) | [circe-aarch64-unknown-linux-musl.tar.gz](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-aarch64-unknown-linux-musl.tar.gz) | | |
| Windows | x86_64 | [circe-x86_64-pc-windows-msvc.zip](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/circe-x86_64-pc-windows-msvc.zip) | | |
See [checksums.txt](https://github.com/fossas/circe/releases/download/${{ steps.get_version.outputs.VERSION }}/checksums.txt) for file checksums. | |
draft: false | |
prerelease: ${{ contains(github.ref, '-') }} |