Add GitHub Actions workflow for building and releasing executable #1
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@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
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@v2 | |
with: | |
name: executable | |
path: dist/main | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v1.0.0 | |
release_name: Release v1.0.0 | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Upload to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v1.0.0 | |
files: dist/main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |