refactor: use tag as version #38
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: 'publish' | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.rs' | |
workflow_dispatch: | |
concurrency: production | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Restore Apt packages | |
uses: awalsh128/[email protected] | |
with: | |
packages: liblzma-dev libclang1 gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu | |
version: "1.0" | |
- name: Install Rust toolchain | |
uses: dtolnay/[email protected] | |
with: | |
targets: "armv7-unknown-linux-gnueabihf,aarch64-unknown-linux-gnu" | |
- name: Restore Rust cache | |
uses: Swatinem/[email protected] | |
- name: Setup cargo-binstall | |
uses: cargo-bins/[email protected] | |
- name: Install cargo-deb | |
run: cargo binstall --force --no-confirm [email protected] | |
- name: Tag (Dry run) | |
id: tag-dry | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
INITIAL_VERSION: "1.0.0" | |
DRY_RUN: true | |
- name: Static build (ARM64) | |
run: cargo build --locked --release --target=aarch64-unknown-linux-gnu | |
env: | |
RUSTFLAGS: "-C target-feature=+crt-static" | |
RSPI_BIOS_VERSION: ${{ steps.tag-dry.outputs.new_tag }} | |
- name: Static build (ARMv7) | |
run: cargo build --locked --release --target=armv7-unknown-linux-gnueabihf | |
env: | |
RUSTFLAGS: "-C target-feature=+crt-static" | |
RSPI_BIOS_VERSION: ${{ steps.tag-dry.outputs.new_tag }} | |
- name: Static deb build (ARM64) | |
run: cargo deb --deb-version $RSPI_BIOS_VERSION --locked --target=aarch64-unknown-linux-gnu | |
env: | |
RUSTFLAGS: "-C target-feature=+crt-static" | |
RSPI_BIOS_VERSION: ${{ steps.tag-dry.outputs.new_tag }} | |
- name: Static deb build (ARMv7) | |
run: cargo deb --deb-version $RSPI_BIOS_VERSION --locked --target=armv7-unknown-linux-gnueabihf | |
env: | |
RUSTFLAGS: "-C target-feature=+crt-static" | |
RSPI_BIOS_VERSION: ${{ steps.tag-dry.outputs.new_tag }} | |
- name: Rename binaries | |
run: | | |
cp target/aarch64-unknown-linux-gnu/release/rspi-bios ./rspi-bios_$RSPI_BIOS_VERSION_aarch64-unknown-linux-gnu | |
cp target/armv7-unknown-linux-gnueabihf/release/rspi-bios ./rspi-bios_$RSPI_BIOS_VERSION_armv7-unknown-linux-gnueabihf | |
cp target/aarch64-unknown-linux-gnu/debian/rspi-bios_$RSPI_BIOS_VERSION_arm64.deb ./rspi-bios_$RSPI_BIOS_VERSION_arm64.deb | |
cp target/armv7-unknown-linux-gnueabihf/debian/rspi-bios_$RSPI_BIOS_VERSION_armhf.deb ./rspi-bios_$RSPI_BIOS_VERSION_armhf.deb | |
env: | |
RSPI_BIOS_VERSION: ${{ steps.tag-dry.outputs.new_tag }} | |
- name: Tag (Real run) | |
id: tag-real | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CUSTOM_TAG: ${{ steps.tag-dry.outputs.new_tag }} | |
DRY_RUN: false | |
- name: Release | |
uses: softprops/[email protected] | |
with: | |
tag_name: ${{ steps.tag-dry.outputs.new_tag }} | |
fail_on_unmatched_files: true | |
files: | | |
rspi-bios_${{ steps.tag-dry.outputs.new_tag }}_aarch64-unknown-linux-gnu | |
rspi-bios_${{ steps.tag-dry.outputs.new_tag }}_armv7-unknown-linux-gnueabihf | |
rspi-bios_${{ steps.tag-dry.outputs.new_tag }}_arm64.deb | |
rspi-bios_${{ steps.tag-dry.outputs.new_tag }}_armhf.deb |