-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (204 loc) · 7.18 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Release
on:
# Triggers the workflow on push events but only for the master branch
push:
tags:
- "v*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up GPG
run: |
echo "$GPG_PRIVATE_KEY" | base64 -d --ignore-garbage | gpg --import --batch
gpg --list-secret-keys --keyid-format LONG
gpg --list-keys
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Build
run: cargo build --release --bin satori
env:
CARGO_TERM_COLOR: always
# - name: Sign Binary
# run: |
# echo "$GPG_PRIVATE_KEY" | gpg --batch --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor -u devops@satoricyber.com --output gpg.sig target/release/satori
# env:
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Move binary
run: |
mv target/release/satori satori
- name: Generate auto complete
run: ./satori auto_complete --generate bash --out satori_auto_complete.sh
- id: get_version
uses: battila7/get-version-action@v2
- name: Create release
run: |
zip -jr satori-${{ steps.get_version.outputs.version-without-v }}-linux.zip satori satori_auto_complete.sh
tar czf satori-${{ steps.get_version.outputs.version-without-v }}-linux.tar.gz satori satori_auto_complete.sh
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.tar.gz
./**/*.zip
gpg.sig
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: rustup
run: |
rustup target add x86_64-apple-darwin
- name: Build
run: cargo build --release --bin satori
env:
CARGO_TERM_COLOR: always
- name: move binary
run: |
mv target/release/satori.exe satori.exe
- name: Generate auto complete
run: |
./satori.exe auto_complete --generate powershell --out satori_auto_complete.ps1
- id: get_version
uses: battila7/get-version-action@v2
- name: Create release
run: |
Compress-Archive -Path "satori.exe", "satori_auto_complete.ps1" -DestinationPath "satori-${{ steps.get_version.outputs.version-without-v }}-windows.zip"
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: satori-windows-artifact
path: |
satori.exe
satori_auto_complete.ps1
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.zip
build-macOS-ARM:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: get_version
uses: battila7/get-version-action@v2
- name: add arm64 target
run: |
rustup target add aarch64-apple-darwin
- name: Install Dependencies
run: |
brew install qemu
brew install FiloSottile/musl-cross/musl-cross
- name: Build
run: cargo build --target=aarch64-apple-darwin --release --bin satori
env:
CARGO_TERM_COLOR: always
- name: rename binary
run: |
mv target/aarch64-apple-darwin/release/satori satori_arm64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: satori_arm64
path: satori_arm64
build-macOS-intel:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: rustup
run: |
rustup target add x86_64-apple-darwin
- name: Build
run: cargo build --target=x86_64-apple-darwin --release --bin satori
env:
CARGO_TERM_COLOR: always
- name: rename binary
run: |
mv target/x86_64-apple-darwin/release/satori satori_x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: satori_x86_64
path: satori_x86_64
publish-windows:
needs: [build-windows]
runs-on: ubuntu-latest
steps:
- name: download artifact windows
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: satori-windows-artifact
- name: Display artifacts
run: |
ls -R
- id: get_version
uses: battila7/get-version-action@v2
- name: Create release
run: |
tar czf satori-${{ steps.get_version.outputs.version-without-v }}-windows.tar.gz satori.exe satori_auto_complete.ps1
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.tar.gz
publish-mac:
needs: [build-macOS-intel, build-macOS-ARM]
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: satori_*
- name: Display artifacts
run: |
ls -R
- name: universal binary
run: |
lipo -create -output satori satori_x86_64 satori_arm64
- id: get_version
uses: battila7/get-version-action@v2
- name: generate autocomlete for zsh
run: |
chmod a+x satori
./satori auto_complete --generate zsh --out satori_auto_complete.zsh
- name: Create release
run: |
zip -jr satori-${{ steps.get_version.outputs.version-without-v }}-macOS.zip satori satori_auto_complete.zsh
tar czf satori-${{ steps.get_version.outputs.version-without-v }}-macOS.tar.gz satori satori_auto_complete.zsh
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.tar.gz
./**/*.zip
- name: Homebew
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: satori_cli
formula-path: Formula/satori_cli.rb
download-url: https://github.com/SatoriCyber/satori-cli/releases/download/v${{ steps.get_version.outputs.version-without-v }}/satori-${{ steps.get_version.outputs.version-without-v }}-macOS.tar.gz
homebrew-tap: SatoriCyber/homebrew-satori
env:
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}