Skip to content

Commit

Permalink
ci: release aarch64 linux
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Jan 12, 2024
1 parent 5467f69 commit efe7553
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
name: Build and upload binaries to release

permissions:
contents: write

on:
push:
tags:
- "v*"

jobs:
release:
name: Publish for ${{ matrix.os }}
name: Publish for ${{ matrix.asset_name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: target/release/stoic-quotes
asset_name: stoic-quotes-linux-amd64
asset_name: linux-amd64
target: "false"
- os: ubuntu-latest
artifact_name: target/aarch64-unknown-linux-gnu/release/stoic-quotes
asset_name: linux-aarch64
target: aarch64-unknown-linux-gnu
- os: macos-latest
artifact_name: target/release/stoic-quotes
asset_name: stoic-quotes-macos-amd64
asset_name: macos-amd64
target: "false"
- os: macos-latest
artifact_name: target/aarch64-apple-darwin/release/stoic-quotes
asset_name: macos-aarch64
target: aarch64-apple-darwin
steps:
- name: Get the version
id: get_version
Expand All @@ -26,12 +39,27 @@ jobs:
uses: actions/checkout@v4
- name: Set-up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux aarch64 deps
run: |
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
mkdir -p .cargo
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml
fi
- name: Build project
run: cargo build --release --locked
run: |
# hack for aarch64
FLAGS=""
if [ "${{ matrix.target }}" != "false" ]; then
FLAGS="--target=${{ matrix.target }}"
rustup target add "${{ matrix.target }}"
fi
cargo build --release --locked $FLAGS
- name: Upload binary to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
asset_name: stoic-quotes-${{ matrix.asset_name }}
tag: ${{ steps.get_version.outputs.VERSION }}

0 comments on commit efe7553

Please sign in to comment.