Skip to content

Commit 7ee34a3

Browse files
Pipeline with Build and Release
1 parent 6ccc8d4 commit 7ee34a3

2 files changed

Lines changed: 276 additions & 2 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
name: Upload Python Package
1010

1111
on:
12-
release:
13-
types: [published]
12+
workflow_run:
13+
workflows: ["Build and Release"]
14+
types:
15+
- completed
16+
workflow_dispatch:
1417

1518
jobs:
1619
deploy:

.github/workflows/release.yml

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
env:
10+
python_package_name: nessus-file-analyzer
11+
folder_package_name: nessus_file_analyzer
12+
app_name: LimberDuck NFA
13+
app_name_dash: LimberDuck-NFA
14+
15+
jobs:
16+
changelog:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest]
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Upload artifact with CHANGELOG
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: ${{ matrix.os }}-changelog
29+
path: CHANGELOG.md
30+
31+
build-linux:
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
matrix:
35+
os: [ubuntu-latest]
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: "3.13"
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m venv venv
48+
./venv/bin/python -m pip install --upgrade pip
49+
./venv/bin/python -m pip install pyinstaller
50+
./venv/bin/python -m pip install -r requirements.txt
51+
52+
- name: Build
53+
run: |
54+
./venv/bin/python -m pip list
55+
./venv/bin/python -m PyInstaller ${{ env.folder_package_name }}/__main__.py --name "${{ env.app_name_dash }}" --onefile --windowed --icon=./icons/${{ env.app_name_dash }}.ico --distpath dist
56+
57+
- name: Archive binary
58+
run: |
59+
cd dist
60+
ls -la .
61+
mkdir ${{ env.app_name_dash }}-${{ github.ref_name }}-linux
62+
mv "${{ env.app_name_dash }}" ${{ env.app_name_dash }}-${{ github.ref_name }}-linux
63+
zip -r ${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip ${{ env.app_name_dash }}-${{ github.ref_name }}-linux
64+
ls -la .
65+
66+
- name: Upload artifact with binary
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ${{ matrix.os }}-binary
70+
path: dist/${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip
71+
72+
build-windows:
73+
runs-on: ${{ matrix.os }}
74+
strategy:
75+
matrix:
76+
os: [windows-latest]
77+
needs: build-linux
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Set up Python
83+
uses: actions/setup-python@v5
84+
with:
85+
python-version: "3.13"
86+
87+
- name: Install dependencies
88+
run: |
89+
python -m venv venv
90+
.\venv\Scripts\python -m pip install --upgrade pip
91+
.\venv\Scripts\python -m pip install pyinstaller
92+
.\venv\Scripts\python -m pip install -r requirements.txt
93+
94+
- name: Build
95+
run: |
96+
.\venv\Scripts\python -m pip list
97+
.\venv\Scripts\python -m PyInstaller ${{ env.folder_package_name }}\__main__.py --name "${{ env.app_name }}" --onefile --windowed --version-file=.\version.rc --icon=.\icons\${{ env.app_name_dash }}.ico --distpath dist
98+
99+
- name: Archive binary
100+
run: |
101+
cd dist
102+
dir .
103+
mkdir ${{ env.app_name_dash }}-${{ github.ref_name }}-windows
104+
mv '${{ env.app_name }}.exe' ${{ env.app_name_dash }}-${{ github.ref_name }}-windows
105+
tar -a -c -f ${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip ${{ env.app_name_dash }}-${{ github.ref_name }}-windows
106+
dir .
107+
108+
- name: Upload artifact with binary
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: ${{ matrix.os }}-binary
112+
path: dist\${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip
113+
114+
build-macos-arm64:
115+
runs-on: ${{ matrix.os }}
116+
strategy:
117+
matrix:
118+
os: [macos-latest]
119+
needs: build-windows
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v4
123+
124+
- name: Set up Python
125+
uses: actions/setup-python@v5
126+
with:
127+
python-version: "3.13"
128+
129+
- name: Install dependencies
130+
run: |
131+
python -m venv venv
132+
./venv/bin/python -m pip install --upgrade pip
133+
./venv/bin/python -m pip install pyinstaller
134+
./venv/bin/python -m pip install -r requirements.txt
135+
136+
- name: Build
137+
run: |
138+
./venv/bin/python -m pip list
139+
./venv/bin/python -m PyInstaller ${{ env.folder_package_name }}/__main__.py --name "${{ env.app_name }}" --windowed --icon=./icons/${{ env.app_name_dash }}.ico --distpath dist
140+
141+
- name: Archive binary
142+
run: |
143+
cd dist
144+
ls -la .
145+
mkdir ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64
146+
mv "${{ env.app_name }}.app" ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64
147+
zip -r ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64
148+
ls -la .
149+
150+
- name: Upload artifact with binary
151+
uses: actions/upload-artifact@v4
152+
with:
153+
name: ${{ matrix.os }}-binary
154+
path: dist/${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip
155+
156+
build-macos:
157+
runs-on: ${{ matrix.os }}
158+
strategy:
159+
matrix:
160+
os: [macos-latest-large]
161+
needs: build-macos-arm64
162+
steps:
163+
- name: Checkout code
164+
uses: actions/checkout@v4
165+
166+
- name: Set up Python
167+
uses: actions/setup-python@v5
168+
with:
169+
python-version: "3.13"
170+
171+
- name: Install dependencies
172+
run: |
173+
python -m venv venv
174+
./venv/bin/python -m pip install --upgrade pip
175+
./venv/bin/python -m pip install pyinstaller
176+
./venv/bin/python -m pip install -r requirements.txt
177+
178+
- name: Build
179+
run: |
180+
./venv/bin/python -m pip list
181+
./venv/bin/python -m PyInstaller ${{ env.folder_package_name }}/__main__.py --name "${{ env.app_name }}" --windowed --icon=./icons/${{ env.app_name_dash }}.ico --distpath dist
182+
183+
- name: Archive binary
184+
run: |
185+
cd dist
186+
ls -la .
187+
mkdir ${{ env.app_name_dash }}-${{ github.ref_name }}-macos
188+
mv "${{ env.app_name }}.app" ${{ env.app_name_dash }}-${{ github.ref_name }}-macos
189+
zip -r ${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip ${{ env.app_name_dash }}-${{ github.ref_name }}-macos
190+
ls -la .
191+
192+
- name: Upload artifact with binary
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: ${{ matrix.os }}-binary
196+
path: dist/${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip
197+
198+
199+
release:
200+
needs: [changelog, build-linux, build-windows, build-macos, build-macos-arm64]
201+
runs-on: ubuntu-latest
202+
steps:
203+
- name: Download all artifacts
204+
uses: actions/download-artifact@v4
205+
with:
206+
path: ./downloaded-app-artifacts
207+
208+
- name: Generate SHA256 for Linux binary
209+
run: |
210+
cd downloaded-app-artifacts/ubuntu-latest-binary
211+
sha256sum ${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip > ${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip.sha256
212+
ls -la
213+
214+
- name: Generate SHA256 for macOS arm64 binary
215+
run: |
216+
cd downloaded-app-artifacts/macos-latest-binary
217+
sha256sum ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip > ${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip.sha256
218+
ls -la
219+
220+
- name: Generate SHA256 for macOS binary
221+
run: |
222+
cd downloaded-app-artifacts/macos-latest-large-binary
223+
sha256sum ${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip > ${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip.sha256
224+
ls -la
225+
226+
- name: Generate SHA256 for Windows binary
227+
run: |
228+
cd downloaded-app-artifacts/windows-latest-binary
229+
sha256sum ${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip > ${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip.sha256
230+
ls -la
231+
232+
- name: Check location
233+
run: |
234+
ls -la
235+
ls -la ./downloaded-app-artifacts
236+
ls -la ./downloaded-app-artifacts/ubuntu-latest-changelog
237+
ls -la ./downloaded-app-artifacts/ubuntu-latest-binary
238+
ls -la ./downloaded-app-artifacts/macos-latest-binary
239+
ls -la ./downloaded-app-artifacts/macos-latest-large-binary
240+
ls -la ./downloaded-app-artifacts/windows-latest-binary
241+
242+
- name: Generate info
243+
run: |
244+
echo "## Summary" > info.md
245+
awk '/^## /{if (p) exit; p=1; next} p' ./downloaded-app-artifacts/ubuntu-latest-changelog/CHANGELOG.md >> info.md
246+
echo "## Checksums" >> info.md
247+
echo "\`$(cat ./downloaded-app-artifacts/ubuntu-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip.sha256)\`" >> info.md
248+
echo "\`$(cat ./downloaded-app-artifacts/macos-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip.sha256)\`" >> info.md
249+
echo "\`$(cat ./downloaded-app-artifacts/macos-latest-large-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip.sha256)\`" >> info.md
250+
echo "\`$(cat ./downloaded-app-artifacts/windows-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip.sha256)\`" >> info.md
251+
252+
- name: Check location
253+
run: |
254+
ls -la
255+
ls -la ./downloaded-app-artifacts
256+
ls -la ./downloaded-app-artifacts/ubuntu-latest-binary
257+
ls -la ./downloaded-app-artifacts/macos-latest-binary
258+
ls -la ./downloaded-app-artifacts/macos-latest-large-binary
259+
ls -la ./downloaded-app-artifacts/windows-latest-binary
260+
261+
- name: Create GitHub Release
262+
uses: softprops/action-gh-release@v2
263+
with:
264+
files: |
265+
./downloaded-app-artifacts/ubuntu-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-linux.zip
266+
./downloaded-app-artifacts/macos-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-macos-arm64.zip
267+
./downloaded-app-artifacts/macos-latest-large-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-macos.zip
268+
./downloaded-app-artifacts/windows-latest-binary/${{ env.app_name_dash }}-${{ github.ref_name }}-windows.zip
269+
body_path: info.md
270+
env:
271+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)