Update GitHub Actions workflow to use latest action versions and impr… #2
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
name: Build Executable | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 # Updated to latest version | |
- name: Set up Python | |
uses: actions/setup-python@v5 # Updated to latest version | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt # Ensure you have a requirements.txt file | |
- name: Build executable | |
run: | | |
pip install pyinstaller | |
pyinstaller --onefile main.py # Change 'main.py' to your main script name | |
- name: Upload executable | |
uses: actions/upload-artifact@v4 # Updated to v4 | |
with: | |
name: executable | |
path: dist/main | |
retention-days: 5 # Optional: specify retention period | |
- 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 | |
with: | |
files: dist/main | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use built-in token instead of custom token |