Skip to content

Update build.yml

Update build.yml #20

Workflow file for this run

name: Multi-Platform Build
on:
push:
branches: [ "main" ]
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
short_name: wgwarden-win
extension: .exe
- os: ubuntu-latest
short_name: wgwarden-linux
extension: ""
- os: macos-latest
short_name: wgwarden-mac
extension: ""
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install pyinstaller cryptography qrcode[pil] Pillow
- name: Build with PyInstaller
# This creates a file like "wgwarden-win-v0.3.3"
run: pyinstaller --onefile --noconsole --name "${{ matrix.short_name }}-${{ github.ref_name || 'dev' }}" src/wgwarden.py
- name: Release
uses: softprops/action-gh-release@v2
# Only run if this is a tag push
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ github.ref_name }}
# The wildcard * catches the extension (.exe) automatically
files: dist/${{ matrix.short_name }}-${{ github.ref_name }}*
append_body: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}