-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (58 loc) · 1.82 KB
/
main.yaml
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
on:
workflow_dispatch:
push:
branches:
- main
release:
types: [created, edited]
name: Main
jobs:
build_and_test:
name: Rust project
runs-on: ubuntu-latest
strategy:
matrix:
target:
- armv7-unknown-linux-musleabi
- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
steps:
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get latest tag
id: get-latest-tag
run: |
echo LATEST_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1)) >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- uses: actions-rs/cargo@v1
name: Build and test
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target }}
- name: Package
if: github.event_name == 'release' && github.event.action == 'created'
run: |
make bundle_release TARGET=${{ matrix.target }}
- uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && (github.event.action == 'created' || github.event.action == 'edited')
name: Upload release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target}}/release/kubediff_${{ matrix.target }}.tar.gz
asset_name: kubediff_${{ env.LATEST_TAG }}_${{ matrix.target }}.tar.gz
tag: ${{ env.LATEST_TAG }}