-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (100 loc) · 3.42 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
on:
push:
branches:
- "master"
tags:
- "v*"
env:
CARGO_INCREMENTAL: 0
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- run: |
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64-x86-64
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
components: clippy
override: true
target: x86_64-unknown-linux-gnu
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
target: x86_64-pc-windows-gnu
- name: cache dependencies
uses: Swatinem/rust-cache@v2.7.3
- name: Set environment
run: |
echo RUSTFLAGS='--cfg reqwest_unstable' >> "$GITHUB_ENV"
- name: clippy check
uses: actions-rs/clippy-check@v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: install cargo-license
uses: actions-rs/cargo@v1.0.3
with:
command: install
args: cargo-license
- name: compile for unit test
uses: actions-rs/cargo@v1.0.3
with:
command: test
args: --no-run --locked
- name: unit test
uses: actions-rs/cargo@v1.0.3
with:
command: test
- run: |
cargo build --release --target x86_64-unknown-linux-gnu
cargo build --release --target x86_64-pc-windows-gnu
mkdir http-request-duplicator
cargo license \
--authors \
--do-not-bundle \
--avoid-dev-deps \
--avoid-build-deps \
--filter-platform x86_64-pc-windows-gnu \
> http-request-duplicator/CREDITS
VERSION_NAME=${GITHUB_REF##*/}
if [[ $VERSION_NAME == "master" ]]; then
VERSION_NAME=$(git rev-parse --short HEAD)
elif [[ ${VERSION_NAME:0:1} == "v" ]]; then
VERSION_NAME=${VERSION_NAME:1}
fi
echo "$VERSION_NAME" > http-request-duplicator/VERSION.txt
cp LICENSE README.md http-request-duplicator/
cp target/x86_64-pc-windows-gnu/release/http-request-duplicator.exe http-request-duplicator/
zip -r http-request-duplicator-windows.zip http-request-duplicator
rm http-request-duplicator/*.exe
cargo license \
--authors \
--do-not-bundle \
--avoid-dev-deps \
--avoid-build-deps \
--filter-platform x86_64-unknown-linux-gnu \
> http-request-duplicator/CREDITS
cp target/x86_64-unknown-linux-gnu/release/http-request-duplicator http-request-duplicator/
zip -r http-request-duplicator-linux.zip http-request-duplicator
- name: pre-release
uses: marvinpinto/action-automatic-releases@latest
if: "! startsWith(github.ref, 'refs/tags/')"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
http-request-duplicator-windows.zip
http-request-duplicator-linux.zip
- name: tagged-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
http-request-duplicator-windows.zip
http-request-duplicator-linux.zip