Skip to content

Commit

Permalink
Refactor GitHub Actions workflow to build Windows executable; renamed…
Browse files Browse the repository at this point in the history
… job, streamlined steps, and updated artifact handling for improved clarity and functionality.
  • Loading branch information
JHM69 committed Dec 13, 2024
1 parent cb2b803 commit 430c52b
Showing 1 changed file with 13 additions and 30 deletions.
43 changes: 13 additions & 30 deletions .github/workflows/main.yml
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

0 comments on commit 430c52b

Please sign in to comment.