Skip to content

Commit 367db81

Browse files
Create build-release.yml
1 parent 8f1aea6 commit 367db81

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# .github/workflows/build-release.yml
2+
name: Build Release
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
build:
13+
runs-on: ${{matrix.os}}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install dependencies
28+
run: pip install nuitka json5
29+
30+
- name: Build with Nuitka
31+
run: |
32+
cd src
33+
nuitka --standalone \
34+
--output-filename=fancyfetch \
35+
--output-dir=dist \
36+
--include-module=setup \
37+
--include-module=constants \
38+
--include-module=formatting \
39+
--include-module=shared \
40+
--include-module=configurationhandler \
41+
--nofollow-import-to=src.defaults \
42+
--assume-yes-for-downloads \
43+
main.py
44+
shell: bash
45+
46+
- name: Copy defaults directory
47+
run: |
48+
cp -r src/defaults src/dist/main.dist/defaults
49+
shell: bash
50+
51+
- name: Create archive (Linux/Mac)
52+
if: runner.os != 'Windows'
53+
run: |
54+
cd src/dist
55+
tar -czf fancyfetch-${{runner.os}}.tar.gz main.dist/
56+
mv fancyfetch-${{runner.os}}.tar.gz ../../
57+
58+
- name: Create archive (Windows)
59+
if: runner.os == 'Windows'
60+
run: |
61+
cd src/dist
62+
7z a fancyfetch-Windows.zip main.dist/
63+
move fancyfetch-Windows.zip ../../
64+
shell: cmd
65+
66+
- name: Upload build artifacts
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: fancyfetch-${{runner.os}}
70+
path: |
71+
fancyfetch-*.tar.gz
72+
fancyfetch-*.zip
73+
retention-days: 30
74+
75+
- name: Upload to release (on release only)
76+
if: github.event_name == 'release'
77+
uses: softprops/action-gh-release@v1
78+
with:
79+
files: |
80+
fancyfetch-*.tar.gz
81+
fancyfetch-*.zip
82+
env:
83+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)