-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (111 loc) · 3.71 KB
/
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
on:
push:
tags:
- 'v*.*.*'
name: release
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Get name of current tag
id: get_tag_name
run: echo "::set-output name=tag_name::${GITHUB_REF/refs\/tags\//}"
- name: Generate changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
args: -vv --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Set release body
id: changelog
run: |
if log=$(cat ${{ steps.git-cliff.outputs.changelog }}); then
log="${log//'%'/'%25'}"
log="${log//'~'/\\~}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=release_body::$log"
else
echo "::set-output name=release_body::log generation failed"
fi
- name: Upload built assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.get_tag_name.outputs.tag_name }}
release_name: ${{ steps.get_tag_name.outputs.tag_name }}
body: ${{ steps.changelog.outputs.release_body }}
file: LICENSE-*
file_glob: true
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
build: [x86_64, armv7, aarch64]
include:
- build: x86_64
toolchain: stable
target: x86_64-unknown-linux-gnu
cross: false
strip_bin: strip
- build: armv7
toolchain: stable
target: armv7-unknown-linux-gnueabihf
cross: true
cross_helpers: gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
strip_bin: arm-linux-gnueabihf-strip
- build: aarch64
toolchain: stable
target: aarch64-unknown-linux-gnu
cross: true
cross_helpers: gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
strip_bin: aarch64-linux-gnu-strip
steps:
- name: Install Linker
if: ${{ matrix.cross }}
run: |
sudo apt update
sudo apt install ${{ matrix.cross_helpers }}
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
#override: true
- name: Compile dt-cli
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.cross }}
- name: Fetch all tags
run: git fetch origin +refs/tags/*:refs/tags/*
- name: Get name of current tag
id: get_tag_name
run: echo "::set-output name=tag_name::${GITHUB_REF/refs\/tags\//}"
- name: Strip debug symbols
run: |
${{ matrix.strip_bin }} --strip-all target/${{ matrix.target }}/release/dt-cli
- name: Give a name to built binary
run: |
mv target/${{ matrix.target }}/release/dt-cli dt-cli-${{ steps.get_tag_name.outputs.tag_name }}-${{ matrix.build }}
- name: Upload built assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
release_name: ${{ steps.get_tag_name.outputs.tag_name }}
file: dt-cli-${{ steps.get_tag_name.outputs.tag_name }}-${{ matrix.build }}
# Author: Blurgy <[email protected]>
# Date: Oct 07 2021, 00:39 [CST]