-
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.
Enhance GitHub Actions workflow for building and deploying Python exe…
…cutable; updated Python version to 3.12, improved dependency installation, and added verification steps.
- Loading branch information
Showing
1 changed file
with
30 additions
and
16 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,45 +1,59 @@ | ||
name: Build Executable | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 # Updated to latest version | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 # Updated to latest version | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
python-version: '3.12' | ||
|
||
- name: Install dependencies | ||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt # Ensure you have a requirements.txt file | ||
pip --version | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install wheel | ||
pip install -r requirements.txt || pip install google-generativeai | ||
- name: Verify installations | ||
run: | | ||
python --version | ||
pip list | ||
- name: Build executable | ||
run: | | ||
pip install pyinstaller | ||
pyinstaller --onefile main.py # Change 'main.py' to your main script name | ||
pyinstaller --onefile main.py | ||
- name: Upload executable | ||
uses: actions/upload-artifact@v4 # Updated to v4 | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: executable | ||
path: dist/main | ||
retention-days: 5 # Optional: specify retention period | ||
path: dist/main | ||
retention-days: 5 | ||
|
||
- name: Create Release and Upload Assets | ||
uses: softprops/action-gh-release@v2 # Updated to v2 | ||
if: startsWith(github.ref, 'refs/tags/') # Only run on tag pushes | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: dist/main | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use built-in token instead of custom token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |