This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (60 loc) · 2.03 KB
/
ci.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
66
67
68
69
70
71
72
73
name: Continuous Integration
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-x86_64-unknown-linux-musl-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x86_64-unknown-linux-musl-
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
- run: cargo install --force cargo-deb
- name: "Find version"
if: startsWith(github.ref, 'refs/tags/')
id: meta
uses: docker/metadata-action@v5
with:
images: image
tags: type=semver,pattern={{version}}
- name: "Adjust version number in Cargo.toml"
if: startsWith(github.ref, 'refs/tags/')
run: |
sed -i'' "s/0\\.0\\.0-git/${{ steps.meta.outputs.version }}/" Cargo.toml
sed -i'' "s/0\\.0\\.0-git/${{ steps.meta.outputs.version }}/" Cargo.lock
- name: "Build project for VyOS"
run: cargo build --target x86_64-unknown-linux-musl --release
- name: "Build debian package"
run: cargo deb --no-build --no-strip --target x86_64-unknown-linux-musl
- name: "Rename artifacts"
run: |
mv target/x86_64-unknown-linux-musl/release/wpm-api-vyos .
mv target/x86_64-unknown-linux-musl/debian/wpm-api-vyos_*_amd64.deb .
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
with:
name: vyos-wpm-api
path: |
wpm-api-vyos
wpm-api-vyos_*_amd64.deb
- uses: crazy-max/ghaction-github-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
wpm-api-vyos
wpm-api-vyos_*_amd64.deb