Build and Release The Executable #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 and Release The Executable | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number (e.g., v1.0.0)' | |
required: true | |
jobs: | |
build-and-release: | |
runs-on: windows-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' # Specify your Python version | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyinstaller requests pycryptodomex pywin32 | |
# Step 4: Build the Python script into an .exe using PyInstaller | |
- name: Build executable | |
run: | | |
pyinstaller --onefile --icon icon.ico -w WindowsNt.py | |
# Step 5: Create GitHub Release and Upload the .exe | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: Release ${{ github.event.inputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload .exe to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/WindowsNt.exe | |
asset_name: WindowsNt.exe | |
asset_content_type: application/octet-stream |