Skip to content

Commit d226139

Browse files
committed
Create GitHub Build and Release Workflow
1 parent e82b3e0 commit d226139

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build and Release ModpackDebuggerKit
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "version"
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build for ${{ matrix.os }}
13+
runs-on: ${{ matrix.runner }}
14+
strategy:
15+
matrix:
16+
include:
17+
- os: Windows
18+
runner: windows-latest
19+
suffix: Win64
20+
- os: Linux
21+
runner: ubuntu-latest
22+
suffix: Linux
23+
- os: macOS
24+
runner: macos-latest
25+
suffix: macOS
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.11"
35+
36+
- name: Install PyInstaller
37+
run: pip install pyinstaller
38+
39+
- name: Read version
40+
id: version
41+
run: echo "version=$(cat version)" >> $GITHUB_OUTPUT
42+
43+
- name: Build executable (multi-file)
44+
run: |
45+
pyinstaller --noconfirm --onedir modpack_debugger.py
46+
47+
- name: Zip distribution
48+
run: |
49+
cd dist
50+
zip -r "../ModpackDebuggerKit_${{ steps.version.outputs.version }}_${{ matrix.suffix }}.zip" main/
51+
shell: bash
52+
53+
- name: Upload artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ModpackDebuggerKit_${{ matrix.suffix }}
57+
path: ModpackDebuggerKit_${{ steps.version.outputs.version }}_${{ matrix.suffix }}.zip
58+
59+
release:
60+
name: Create GitHub Release
61+
runs-on: ubuntu-latest
62+
needs: build
63+
64+
steps:
65+
- name: Checkout repository
66+
uses: actions/checkout@v4
67+
68+
- name: Read version
69+
id: version
70+
run: echo "version=$(cat version)" >> $GITHUB_OUTPUT
71+
72+
- name: Download all build artifacts
73+
uses: actions/download-artifact@v4
74+
75+
- name: Get previous release tag (if any)
76+
id: prev
77+
run: |
78+
prev=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' || true)
79+
echo "previous=$prev" >> $GITHUB_OUTPUT
80+
env:
81+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Create release
84+
env:
85+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
run: |
87+
v="${{ steps.version.outputs.version }}"
88+
prev="${{ steps.prev.outputs.previous }}"
89+
if [ -n "$prev" ]; then
90+
changes="See changes since previous release: https://github.com/${{ github.repository }}/compare/$prev...$v"
91+
else
92+
changes="Initial release."
93+
fi
94+
95+
gh release create "$v" \
96+
--title "$v" \
97+
--notes "$changes" \
98+
ModpackDebuggerKit_Win64/ModpackDebuggerKit_${v}_Win64.zip \
99+
ModpackDebuggerKit_Linux/ModpackDebuggerKit_${v}_Linux.zip \
100+
ModpackDebuggerKit_macOS/ModpackDebuggerKit_${v}_macOS.zip

version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

0 commit comments

Comments
 (0)