name: Linux Build & Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
jobs:
linux-build-amd64:
name: Build & Upload Linux AMD64
runs-on: ubuntu-latest
steps:
- name: App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.TODD_APP_ID }}
private-key: ${{ secrets.TODD_PRIVATE_KEY }}
owner: tod-org
repositories: tod
- name: Checkout repo
uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Run platform tests
run: cargo nextest run --all-features
- name: Install Cargo Get
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version
- name: Get version and tag
id: version
run: |
echo "VERSION=$(cargo get package.version)" >> $GITHUB_ENV
echo "TAG=$(cargo get package.version --pretty)" >> $GITHUB_ENV
- name: Build
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Package
run: |
tar -czf target/release/tod-$VERSION-linux-amd64.tar.gz \
-C target/x86_64-unknown-linux-gnu/release tod
shasum -a 256 target/release/tod-$VERSION-linux-amd64.tar.gz
- name: Upload to Github
run: |
gh release upload "$TAG" \
target/release/tod-$VERSION-linux-amd64.tar.gz \
--repo "$GITHUB_REPOSITORY" --clobber
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
TAG: ${{ env.TAG }}
VERSION: ${{ env.VERSION }}
linux-build-arm64:
name: Build & Upload Linux ARM64
runs-on: ubuntu-24.04-arm
steps:
- name: App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.TODD_APP_ID }}
private-key: ${{ secrets.TODD_PRIVATE_KEY }}
owner: tod-org
- name: Checkout repo
uses: actions/checkout@v6
- name: Install Rust Toolchain
run: rustup toolchain install
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- name: Run platform tests
run: cargo nextest run --all-features
- name: Install Cargo Get
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version
- name: Get version and tag
id: version
run: |
echo "VERSION=$(cargo get package.version)" >> $GITHUB_ENV
echo "TAG=$(cargo get package.version --pretty)" >> $GITHUB_ENV
- name: Build
run: cargo build --release --target aarch64-unknown-linux-gnu
- name: Package
run: |
tar -czf target/release/tod-$VERSION-linux-arm64.tar.gz \
-C target/aarch64-unknown-linux-gnu/release tod
shasum -a 256 target/release/tod-$VERSION-linux-arm64.tar.gz
- name: Upload to Github
run: |
gh release upload "$TAG" \
target/release/tod-$VERSION-linux-arm64.tar.gz \
--repo "$GITHUB_REPOSITORY" --clobber
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
TAG: ${{ env.TAG }}
VERSION: ${{ env.VERSION }}