Skip to content

Build and upload release #5

Build and upload release

Build and upload release #5

Workflow file for this run

name: Build and upload release
permissions:
contents: write
on:
release:
types: [published]
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
CARGO_PROFILE_RELEASE_LTO: true
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash
jobs:
upload-assets:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04-arm
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-apple-darwin
os: macos-13
- target: x86_64-apple-darwin
os: macos-13
- target: aarch64-pc-windows-msvc
os: windows-2022
- target: x86_64-pc-windows-msvc
os: windows-2022
steps:
- name: Install Linux system dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libxcb1-dev libdbus-1-dev
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
if: startsWith(matrix.os, 'ubuntu')
- run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
if: endsWith(matrix.target, 'windows-msvc')
- uses: taiki-e/upload-rust-binary-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
bin: tattoy
target: ${{ matrix.target }}
locked: true
checksum: sha256
publish-deb:
name: Publish Debian package
runs-on: ubuntu-22.04
steps:
- name: Install Linux system dependencies
run: sudo apt-get install libxcb1-dev libdbus-1-dev
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Install `cargo-deb`
uses: taiki-e/install-action@v2
with:
tool: cargo-deb
- name: Build Debian package
run: |
cargo build --release --locked --package tattoy
cargo-deb \
--deb-revision="" \
--strip \
--package tattoy \
--verbose \
--output tattoy${{ github.ref_name }}.deb
- name: Upload .deb to the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tattoy${{ github.ref_name }}.deb
tag: ${{ github.ref_name }}
publish-rpm:
name: Publish RPM package
runs-on: ubuntu-22.04
steps:
- name: Install Linux system dependencies
run: sudo apt-get install libxcb1-dev libdbus-1-dev
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Install `cargo-deb`
uses: taiki-e/install-action@v2
with:
tool: cargo-generate-rpm
- name: Build RPM package
run: |
cargo build --release --locked --package tattoy
cargo generate-rpm \
--package tattoy \
--output tattoy-${{ github.ref_name }}.x86_64.rpm
- name: Upload the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tattoy-${{ github.ref_name }}.x86_64.rpm
tag: ${{ github.ref }}