mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-11 16:13:51 +03:00
248 lines
7.3 KiB
YAML
248 lines
7.3 KiB
YAML
name: Builder
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
# schedule:
|
|
# - cron: '0 13 * * *' # run at 1 PM UTC
|
|
workflow_dispatch:
|
|
inputs:
|
|
release:
|
|
type: choice
|
|
description: Release the asset
|
|
default: 'none'
|
|
options:
|
|
- none
|
|
- prerelease
|
|
- release
|
|
bump:
|
|
type: choice
|
|
description: Semver to bump
|
|
default: 'none'
|
|
options:
|
|
- none
|
|
- patch
|
|
- minor
|
|
- major
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build PluginLoader
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout 🧰
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up NodeJS 17 💎
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 17
|
|
|
|
- name: Set up Python 3.10 🐍
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install Python dependencies ⬇️
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pyinstaller
|
|
[ -f requirements.txt ] && pip install -r requirements.txt
|
|
|
|
- name: Install NodeJS dependencies ⬇️
|
|
run: |
|
|
cd frontend
|
|
npm i
|
|
npm run build
|
|
|
|
- name: Build 🛠️
|
|
run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/static --add-data ./backend/legacy:/legacy ./backend/*.py
|
|
|
|
- name: Upload package artifact ⬆️
|
|
if: ${{ !env.ACT }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: PluginLoader
|
|
path: ./dist/PluginLoader
|
|
|
|
- name: Download package artifact locally
|
|
if: ${{ env.ACT }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
path: ./dist/PluginLoader
|
|
|
|
# release:
|
|
# name: Release the package
|
|
# if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }}
|
|
# needs: build
|
|
# runs-on: ubuntu-latest
|
|
|
|
# steps:
|
|
# - name: Checkout 🧰
|
|
# uses: actions/checkout@v3
|
|
|
|
# - name: Fetch package artifact ⬇️
|
|
# uses: actions/download-artifact@v3
|
|
# with:
|
|
# name: PluginLoader
|
|
# path: dist
|
|
|
|
# - name: Release 📦
|
|
# uses: softprops/action-gh-release@v1
|
|
# if: ${{ !env.ACT }}
|
|
# with:
|
|
# name: Release ${{ steps.tag_version.outputs.new_tag }}
|
|
# tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
|
# files: ./dist/PluginLoader
|
|
# generate_release_notes: true
|
|
|
|
release:
|
|
name: Release stable version of the package
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }}
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Install semver-tool asdf
|
|
uses: asdf-vm/actions/install@v1
|
|
with:
|
|
tool_versions: |
|
|
semver 3.3.0
|
|
|
|
- name: Fetch package artifact ⬇️
|
|
uses: actions/download-artifact@v3
|
|
if: ${{ !env.ACT }}
|
|
with:
|
|
name: PluginLoader
|
|
path: dist
|
|
|
|
- name: Get latest release
|
|
uses: rez0n/actions-github-release@main
|
|
id: latest_release
|
|
env:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# repository: "SteamDeckHomebrew/decky-loader"
|
|
repository: "TrainDoctor/decky-loader"
|
|
type: "nodraft"
|
|
|
|
- name: Prepare tag ⚙️
|
|
id: ready_tag
|
|
run: |
|
|
export VERSION=${{ steps.latest_release.outputs.release }}
|
|
echo "VERS: $VERSION"
|
|
OUT="notsemver"
|
|
if [[ "$VERSION" =~ "-pre" ]]; then
|
|
printf "is prerelease, bumping release\n"
|
|
OUT=$(semver bump release "$VERSION")
|
|
printf "OUT: ${OUT}\n"
|
|
if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
|
|
OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT")
|
|
printf "OUT: ${OUT}\n"
|
|
fi
|
|
elif [[ ! "$VERSION" =~ "-pre" ]]; then
|
|
printf "is a release, bumping as selected\n"
|
|
if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
|
|
OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION")
|
|
printf "OUT: ${OUT}\n"
|
|
else
|
|
printf "none bump selected, but cannot have identical tag\n"
|
|
printf "bumping patch\n"
|
|
OUT=$(semver bump patch "$VERSION")
|
|
printf "OUT: ${OUT}\n"
|
|
fi
|
|
fi
|
|
echo "vOUT: v$OUT"
|
|
echo ::set-output name=tag_name::v$OUT
|
|
|
|
- name: Push tag 📤
|
|
uses: rickstaa/action-create-tag@v1.3.2
|
|
if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' && !env.ACT }}
|
|
with:
|
|
tag: ${{ steps.ready_tag.outputs.tag_name }}
|
|
message: Pre-release ${{ steps.ready_tag.outputs.tag_name }}
|
|
|
|
- name: Release 📦
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !env.ACT }}
|
|
with:
|
|
name: Prerelease ${{ steps.ready_tag.outputs.tag_name }}
|
|
tag_name: ${{ steps.ready_tag.outputs.tag_name }}
|
|
files: ./dist/PluginLoader
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
|
|
prerelease:
|
|
name: Release the pre-release version of the package
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'prerelease' }}
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Install semver-tool asdf
|
|
uses: asdf-vm/actions/install@v1
|
|
with:
|
|
tool_versions: |
|
|
semver 3.3.0
|
|
|
|
- name: Fetch package artifact ⬇️
|
|
uses: actions/download-artifact@v3
|
|
if: ${{ !env.ACT }}
|
|
with:
|
|
name: PluginLoader
|
|
path: dist
|
|
|
|
- name: Get latest release
|
|
uses: rez0n/actions-github-release@main
|
|
id: latest_release
|
|
env:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
repository: "SteamDeckHomebrew/decky-loader"
|
|
type: "nodraft"
|
|
|
|
- name: Prepare tag ⚙️
|
|
id: ready_tag
|
|
run: |
|
|
export VERSION=${{ steps.latest_release.outputs.release }}
|
|
echo "VERS: $VERSION"
|
|
OUT="notsemver"
|
|
if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
|
|
printf "bumping by release then by selected\n"
|
|
OUT=$(semver bump release "$VERSION")
|
|
printf "OUT: ${OUT}\n"
|
|
OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT")
|
|
printf "OUT: ${OUT}\n"
|
|
fi
|
|
if [[ ! "$OUT" =~ "-pre" ]]; then
|
|
printf "appending -pre to new prerelease\n"
|
|
OUT="${OUT}-pre"
|
|
printf "OUT: ${OUT}\n"
|
|
fi
|
|
if [[ "$OUT" == "" ]]; then
|
|
OUT=$(semver bump prerel "$VERSION")
|
|
else
|
|
OUT=$(semver bump prerel "$OUT")
|
|
fi
|
|
echo "OUT: v$OUT"
|
|
echo ::set-output name=tag_name::v$OUT
|
|
|
|
- name: Push tag 📤
|
|
uses: rickstaa/action-create-tag@v1.3.2
|
|
if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' && !env.ACT }}
|
|
with:
|
|
tag: ${{ steps.ready_tag.outputs.tag_name }}
|
|
message: Pre-release ${{ steps.ready_tag.outputs.tag_name }}
|
|
|
|
- name: Release 📦
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ github.event_name == 'workflow_dispatch' && !env.ACT }}
|
|
with:
|
|
name: Prerelease ${{ steps.ready_tag.outputs.tag_name }}
|
|
tag_name: ${{ steps.ready_tag.outputs.tag_name }}
|
|
files: ./dist/PluginLoader
|
|
prerelease: true
|
|
generate_release_notes: true
|