mirror of
https://github.com/Horizontal42/warehouse-master.git
synced 2026-11-10 16:02:07 +03:00
87 lines
2.3 KiB
YAML
87 lines
2.3 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag to upload assets to'
|
|
required: true
|
|
default: 'v1.0.0'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag: ${{ steps.tag.outputs.value }}
|
|
steps:
|
|
- name: Resolve tag
|
|
id: tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "value=${{ inputs.tag }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Ensure release exists
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release view "${{ steps.tag.outputs.value }}" --repo "${{ github.repository }}" 2>/dev/null || \
|
|
gh release create "${{ steps.tag.outputs.value }}" \
|
|
--repo "${{ github.repository }}" \
|
|
--title "${{ steps.tag.outputs.value }}" \
|
|
--generate-notes
|
|
|
|
build:
|
|
needs: create-release
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
artifact: WarehouseMaster.exe
|
|
- os: macos-latest
|
|
artifact: WarehouseMaster-macos
|
|
- os: ubuntu-latest
|
|
artifact: WarehouseMaster-linux
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install system deps (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y libxcb-xinerama0 libgl1 libegl1
|
|
|
|
- name: Install Python deps
|
|
run: pip install pyinstaller -r requirements.txt
|
|
|
|
- name: Build
|
|
env:
|
|
QT_QPA_PLATFORM: offscreen
|
|
run: pyinstaller WarehouseMaster.spec
|
|
|
|
- name: Rename artifact (macOS/Linux)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: mv dist/WarehouseMaster "dist/${{ matrix.artifact }}"
|
|
|
|
- name: Upload to release
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: gh release upload "${{ needs.create-release.outputs.tag }}" "dist/${{ matrix.artifact }}" --clobber
|