-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GitHub Actions workflow to build Windows executable; renamed…
… job, streamlined steps, and updated artifact handling for improved clarity and functionality.
- Loading branch information
Showing
1 changed file
with
13 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,43 @@ | ||
name: Build and Release | ||
name: Build Windows Executable | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
build-windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.12 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install wheel | ||
pip install -r requirements.txt || pip install google-generativeai | ||
- name: Build executable | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pyinstaller | ||
pyinstaller --onefile main.py | ||
- name: Generate Release Tag | ||
id: create_tag | ||
- name: Build Windows Executable | ||
run: | | ||
TAG=v1.0.${{ github.run_number }} | ||
echo "tag=$TAG" >> $GITHUB_OUTPUT | ||
pyinstaller --onefile --windowed main.py | ||
- name: Create GitHub Release | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ steps.create_tag.outputs.tag }} | ||
files: dist/main | ||
files: dist/main.exe | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload artifact | ||
- name: Upload Executable Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: executable | ||
path: dist/main | ||
retention-days: 5 | ||
name: windows-exe | ||
path: dist/main.exe |