Skip to content

Build and Release

Build and Release #9

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.12]
include:
- os: macos-latest
arch: arm64
- os: windows-latest
arch: x64
- os: ubuntu-latest
arch: x64
outputs:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
cd source
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build application (Windows)
if: runner.os == 'Windows'
run: |
cd source
pyinstaller --onefile --name pay2xl main.py
shell: cmd
- name: Build application (macOS/Linux)
if: runner.os != 'Windows'
run: |
cd source
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
pyinstaller --onefile --name pay2xl --target-arch ${{ matrix.arch }} main.py
else
pyinstaller --onefile --name pay2xl main.py
fi
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-build-${{ matrix.arch }}
path: source/dist/
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.os }}-build-${{ needs.build.outputs.arch }}
path: ./dist
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/*
asset_name: ${{ needs.build.outputs.os }}-build-${{ needs.build.outputs.arch }}.zip
asset_content_type: application/zip