|
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - '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 |
18 | 7 |
|
19 | 8 | permissions: |
20 | 9 | contents: write |
21 | 10 |
|
22 | 11 | jobs: |
23 | | - release: |
| 12 | + create-release: |
24 | 13 | runs-on: windows-latest |
25 | | - name: Create GitHub Release |
26 | | - |
27 | 14 | steps: |
28 | 15 | - name: Checkout code |
29 | 16 | uses: actions/checkout@v4 |
30 | 17 | with: |
31 | 18 | fetch-depth: 0 |
32 | 19 |
|
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 |
35 | 22 | with: |
36 | | - toolchain: stable |
| 23 | + python-version: '3.10' |
37 | 24 |
|
38 | | - - name: Install git-cliff |
39 | | - shell: pwsh |
| 25 | + - name: Install dependencies |
40 | 26 | run: | |
41 | | - cargo install git-cliff |
42 | | - git-cliff --version |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install PySide6 pynput pywin32 |
43 | 29 |
|
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 |
61 | 32 |
|
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 |
92 | 35 |
|
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 |
98 | 38 |
|
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 |
114 | 41 |
|
115 | 42 | - 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 |
135 | 44 | 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