-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.79 KB
/
build_and_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build and release
on:
push:
tags:
- 'v*'
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 || github.event.inputs.dry_run == 'false' }}
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 || github.event.inputs.dry_run == 'false' }}
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