mirror of
https://github.com/derrod/legendary.git
synced 2026-07-08 23:25:52 +00:00
ci: split actions and move release to ubuntu-slim
This commit is contained in:
parent
ce2bd87261
commit
3c19452360
97
.github/workflows/build-base.yml
vendored
Normal file
97
.github/workflows/build-base.yml
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
name: Build Base
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
pyinstaller:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [
|
||||
'windows-2025', 'windows-11-arm',
|
||||
'macos-15-intel', 'macos-15'
|
||||
]
|
||||
fail-fast: false
|
||||
env:
|
||||
UV_SYSTEM_PYTHON: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Dependencies and build tools
|
||||
run: uv sync --extra pyinstaller_build --no-install-local
|
||||
|
||||
- name: Optional dependencies (WebView)
|
||||
run: uv sync --extra webview --no-install-local --inexact
|
||||
if: runner.os != 'macOS'
|
||||
|
||||
- name: Set strip option on non-Windows
|
||||
id: strip
|
||||
run: echo "option=--strip" >> $GITHUB_OUTPUT
|
||||
if: runner.os != 'Windows'
|
||||
|
||||
- name: Build
|
||||
working-directory: legendary
|
||||
run: uv run --module PyInstaller
|
||||
--onefile
|
||||
--name legendary
|
||||
${{ steps.strip.outputs.option }}
|
||||
-i ../assets/windows_icon.ico
|
||||
cli.py
|
||||
env:
|
||||
PYTHONOPTIMIZE: 1
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ runner.os }}-${{ runner.arch }}-package
|
||||
path: legendary/dist/*
|
||||
|
||||
zipapp:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [
|
||||
'ubuntu-24.04', 'ubuntu-24.04-arm'
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- run: mkdir -p build dist
|
||||
|
||||
- name: Dependencies
|
||||
run: uv export --format requirements.txt --no-editable | uv pip install --requirement - --target build
|
||||
|
||||
- run: cp zipapp_main.py build/__main__.py
|
||||
|
||||
- name: Build
|
||||
run: python -m zipapp
|
||||
--output dist/legendary
|
||||
--python "/usr/bin/env python3"
|
||||
--compress
|
||||
build
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ runner.os }}-${{ runner.arch }}-package
|
||||
path: dist/legendary
|
||||
160
.github/workflows/python.yml
vendored
160
.github/workflows/python.yml
vendored
|
|
@ -3,166 +3,10 @@ name: Python
|
|||
on:
|
||||
push:
|
||||
branches: [ '*' ]
|
||||
tags: [ '*.*.*' ]
|
||||
pull_request:
|
||||
branches: [ '*' ]
|
||||
|
||||
jobs:
|
||||
pyinstaller:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [
|
||||
'windows-2025', 'windows-11-arm',
|
||||
'macos-15-intel', 'macos-15'
|
||||
]
|
||||
fail-fast: false
|
||||
env:
|
||||
UV_SYSTEM_PYTHON: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Dependencies and build tools
|
||||
run: uv sync --extra pyinstaller_build --no-install-local
|
||||
|
||||
- name: Optional dependencies (WebView)
|
||||
run: uv sync --extra webview --no-install-local --inexact
|
||||
if: runner.os != 'macOS'
|
||||
|
||||
- name: Set strip option on non-Windows
|
||||
id: strip
|
||||
run: echo "option=--strip" >> $GITHUB_OUTPUT
|
||||
if: runner.os != 'Windows'
|
||||
|
||||
- name: Build
|
||||
working-directory: legendary
|
||||
run: uv run --module PyInstaller
|
||||
--onefile
|
||||
--name legendary
|
||||
${{ steps.strip.outputs.option }}
|
||||
-i ../assets/windows_icon.ico
|
||||
cli.py
|
||||
env:
|
||||
PYTHONOPTIMIZE: 1
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ runner.os }}-${{ runner.arch }}-package
|
||||
path: legendary/dist/*
|
||||
|
||||
zipapp:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [
|
||||
'ubuntu-24.04', 'ubuntu-24.04-arm'
|
||||
]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- run: mkdir -p build dist
|
||||
|
||||
- name: Dependencies
|
||||
run: uv export --format requirements.txt --no-editable | uv pip install --requirement - --target build
|
||||
|
||||
- run: cp zipapp_main.py build/__main__.py
|
||||
|
||||
- name: Build
|
||||
run: python -m zipapp
|
||||
--output dist/legendary
|
||||
--python "/usr/bin/env python3"
|
||||
--compress
|
||||
build
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ runner.os }}-${{ runner.arch }}-package
|
||||
path: dist/legendary
|
||||
|
||||
# Publishing
|
||||
|
||||
pypi:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
if: github.ref_type == 'tag'
|
||||
env:
|
||||
UV_SYSTEM_PYTHON: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Build
|
||||
run: uv build
|
||||
|
||||
- name: Publish
|
||||
run: uv publish
|
||||
|
||||
release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref_type == 'tag'
|
||||
needs: [pyinstaller, zipapp, pypi]
|
||||
steps:
|
||||
- name: Download builds
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Setup distribution dir
|
||||
run: mkdir dist
|
||||
|
||||
- name: Copy binaries
|
||||
run: |
|
||||
oses=("Linux" "macOS" "Windows")
|
||||
arches=("X64" "ARM64")
|
||||
for os in ${oses[@]}; do
|
||||
for arch in ${arches[@]}; do
|
||||
file="./$os-$arch-package/legendary"*
|
||||
if [ -f $file ]; then
|
||||
filename=$(basename $file)
|
||||
name="${filename%%.*}"
|
||||
ext=${filename#*.}
|
||||
if [[ "$ext" == "$filename" ]]; then
|
||||
ext=""
|
||||
else
|
||||
ext=".$ext"
|
||||
fi
|
||||
cp $file "./dist/legendary_${os,}_${arch,,}$ext"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
- uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
files: release/legendary*
|
||||
build:
|
||||
uses: ./.github/workflows/build-base.yml
|
||||
|
||||
69
.github/workflows/release.yml
vendored
Normal file
69
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ '*.*.*' ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/build-base.yml
|
||||
|
||||
pypi:
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
env:
|
||||
UV_SYSTEM_PYTHON: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Build
|
||||
run: uv build
|
||||
|
||||
- name: Publish
|
||||
run: uv publish
|
||||
|
||||
release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-slim
|
||||
needs: [build, pypi]
|
||||
steps:
|
||||
- name: Download builds
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Setup distribution dir
|
||||
run: mkdir dist
|
||||
|
||||
- name: Copy binaries
|
||||
run: |
|
||||
oses=("Linux" "macOS" "Windows")
|
||||
arches=("X64" "ARM64")
|
||||
for os in ${oses[@]}; do
|
||||
for arch in ${arches[@]}; do
|
||||
file="./$os-$arch-package/legendary"*
|
||||
if [ -f $file ]; then
|
||||
filename=$(basename $file)
|
||||
ext=${filename#*.}
|
||||
if [[ "$ext" == "$filename" ]]; then
|
||||
ext=""
|
||||
else
|
||||
ext=".$ext"
|
||||
fi
|
||||
cp $file "./dist/legendary_${os,}_${arch,,}$ext"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
- uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
files: dist/legendary*
|
||||
Loading…
Reference in a new issue