-
-
Notifications
You must be signed in to change notification settings - Fork 4
137 lines (136 loc) · 4.63 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Release
on:
push:
tags:
- '*'
jobs:
build:
name: Rust ${{ matrix.rust }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - os: macos-latest
# target: x86_64-apple-darwin
# suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch-deb: amd64
arch-rpm: x86_64
suffix: ''
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# suffix: .exe
env:
RUST_BACKTRACE: full
RUSTV: stable
steps:
- uses: actions/checkout@v4
- name: Install Rust
id: rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
- name: Install protoc
run: sudo apt-get install -y protobuf-compiler
- name: Install cargo-get
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-get
- name: Install cargo-deb
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deb
- name: Install cargo-generate-rpm
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-generate-rpm
- name: Cargo Cache
uses: actions/cache@v4
id: cache
continue-on-error: false
with:
path: |
~/.cargo/registry/
target/
key: ${{ runner.os }}-cargo-release
restore-keys: |
${{ runner.os }}-registry
- name: Release build
id: build
run: cargo build --release
- name: Create rpm
if: ${{ matrix.os }} == "ubuntu-latest"
id: rpm-generate
run: cargo generate-rpm
- name: Create deb
id: deb-generate
if: ${{ matrix.os }} == "ubuntu-latest"
run: cargo deb
- name: Version
run: echo "::set-output name=version::$(cargo get version)"
id: version
- name: Changelog
uses: Bullrich/generate-release-changelog@master
id: changelog
env:
REPO: ${{ github.repository }}
- name: Create Release
uses: actions/create-release@v1
id: create-release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body: |
${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload deb to release
id: deb-release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./target/debian/wirespider_${{ steps.version.outputs.version }}_${{ matrix.arch-deb }}.deb
asset_name: wirespider-${{ steps.version.outputs.version }}_${{ matrix.arch-deb }}.deb
asset_content_type: application/vnd.debian.binary-package; charset=binary
- name: Upload rpm to release
id: rpm-release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./target/generate-rpm/wirespider-${{ steps.version.outputs.version }}-1.${{ matrix.arch-rpm }}.rpm
asset_name: wirespider-${{ steps.version.outputs.version }}-1.${{ matrix.arch-rpm }}.rpm
asset_content_type: application/x-rpm; charset=binary
- name: Upload release binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./target/release/wirespider${{ matrix.suffix }}
asset_name: wirespider-${{ steps.version.outputs.version }}-${{ matrix.arch-deb }}
asset_content_type: application/x-pie-executable; charset=binary
- name: Update APT repo
uses: peternewman/apt-repo-action@globs
id: apt-repo
with:
github_token: ${{ github.token }}
repo_supported_arch: |
amd64
i386
repo_supported_version: stable
file: ./target/debian/wirespider_${{ steps.version.outputs.version }}_${{ matrix.arch-deb }}.deb
file_target_version: stable
public_key: ${{ secrets.APT_REPO_PUBKEY }}
private_key: ${{ secrets.APT_REPO_PRIVKEY }}
key_passphrase: ${{ secrets.APT_REPO_KEY_PASSPHRASE }}