forked from dnglab/dnglab
-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (96 loc) · 3.09 KB
/
release.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
# Note this. We are going to use that in further jobs.
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: false
build:
name: Rust build on ${{matrix.os}}
needs: create_release # we need to know the ID
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest]
include:
- os: ubuntu-20.04
install-deps: |
cargo install cargo-deb
sudo apt-get update
sudo apt-get install libc6-dev-arm64-cross crossbuild-essential-arm64
rustup target add aarch64-unknown-linux-gnu
build-cmd: |
RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo deb --no-strip -p dnglab --target=aarch64-unknown-linux-gnu && cp target/aarch64-unknown-linux-gnu/release/dnglab target/aarch64-unknown-linux-gnu/release/dnglab_linux_aarch64
cargo deb -p dnglab && cp target/release/dnglab target/release/dnglab_linux_x64
package-files: |
target/debian/dnglab*.deb
target/release/dnglab_linux_x64
target/aarch64-unknown-linux-gnu/debian/dnglab*.deb
target/aarch64-unknown-linux-gnu/release/dnglab_linux_aarch64
- os: windows-latest
build-cmd: cargo build --release
pkg-cmd: cd target/release/ && 7z a dnglab-win-x64_${GITHUB_REF#refs/*/}.zip dnglab.exe
package-files: target/release/dnglab*.zip
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v2
with:
path: deps/dist
key: ${{ runner.os }}-deps-${{ hashFiles('deps/*') }}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Download deps
run: ${{ matrix.install-deps }}
shell: bash
- name: Build
run: ${{ matrix.build-cmd }}
shell: bash
- name: Debug
if: failure()
uses: actions/upload-artifact@v2
with:
name: debug
path: .
- name: Package
run: ${{ matrix.pkg-cmd }}
shell: bash
- name: Publish
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ matrix.package-files }}
prerelease: false
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#publish:
# runs-on: ubuntu-latest
# needs: [create_release, build]
# steps:
# - uses: eregon/publish-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# release_id: ${{ needs.create_release.outputs.release_id }}