Skip to content

Commit

Permalink
add zigbuild action (#5)
Browse files Browse the repository at this point in the history
change zigbuild name

try without caching and install zigbuild

fix cargo install zigbuild

try with caching

cache zigbuild install
  • Loading branch information
sverrejb committed Feb 17, 2024
1 parent 83fe6a8 commit 26050cf
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/build_and_release_zigbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build and release with Zigbuild

on:
#push:
# tags:
# - 'v*' # Push events matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
dry_run:
type: boolean
description: 'Dry Run'
required: false
default: false
tag:
description: 'Tag'
required: true
default: 'v0.0.0'

run-name: ${{ github.event.inputs.dry_run == 'true' && 'Dry run' || github.event.inputs.tag || github.ref }}

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}


- uses: jethrodaniel/setup-zig@fix-caching
with:
version: 0.12.0-dev.903+7aa85691b

- name: Install Arm compile target
run: rustup target add armv7-unknown-linux-gnueabihf

- name: Install Zigbuild
run: |
if ! command -v cargo-zigbuild &> /dev/null
then
cargo install cargo-zigbuild
fi
- name: Build
run: cargo zigbuild --target armv7-unknown-linux-gnueabihf --release

- name: Create Release
if: ${{ !github.event.inputs.dry_run }}
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/create-release@v1
with:
tag_name: ${{ github.event.inputs.tag || github.ref }}
release_name: Release ${{ github.event.inputs.tag || github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
if: ${{ !github.event.inputs.dry_run }}
id: upload-release-asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./target/armv7-unknown-linux-gnueabihf/release/infoskjerm
asset_name: infoskjerm
asset_content_type: application/zip

0 comments on commit 26050cf

Please sign in to comment.