summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: a6a56f39dee6f2068556718adbb3b30c3355ad2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Builder

on:
  workflow_call:
    inputs:
      arch:
        description: Architecture to build for (x86_64, arm64)
        type: string
        default: x86_64
      os:
        description: OS to build for (Linux, macOS, Windows)
        type: string
        default: Linux
      artifact_name:
        description: Name of the uploaded artifact
        type: string
        default: PluginLoader
      binary_name:
        description: Name of the PluginLoader binary
        type: string
        default: PluginLoader
      noconsole:
        description: If the windows build is no-console
        type: boolean
        default: false

jobs:
  build:
    name: Build ${{ inputs.artifact_name }} (${{ inputs.os }} ${{ inputs.arch }})
    # No support for mac x86, sorry
    runs-on: ${{
      (inputs.os == 'Linux' && inputs.arch == 'arm64' && 'ubuntu-26.04-arm') || 
      (inputs.os == 'Linux' && inputs.arch == 'x86_64' && 'ubuntu-26.04') ||
      (inputs.os == 'macOS' && inputs.arch == 'arm64' && 'xcode-27') || 
      (inputs.os == 'Windows' && inputs.arch == 'arm64' && 'windows-11-arm') ||
      (inputs.os == 'Windows' && inputs.arch == 'x86_64' && 'windows-2025')
       }}
    defaults:
      run:
        shell: bash

    steps:
    - name: Checkout 🧰
      uses: actions/checkout@v7
      with:
        fetch-depth: 0

    - name: Set up NodeJS 26 💎
      uses: actions/setup-node@v7
      with:
        node-version: 26
      
    - name: Set up Python 3.14.8 🐍
      uses: actions/setup-python@v7
      with:
        python-version: "3.14.8"
    
    - name: Install Poetry
      uses: snok/install-poetry@v1
      with:
        virtualenvs-create: false

    - name: Install Python dependencies ⬇️
      working-directory: ./backend
      run: |
        poetry self add "poetry-dynamic-versioning[plugin]"
        poetry install --no-interaction

    - name: Install JS dependencies ⬇️
      working-directory: ./frontend
      run: |
        npm i -g pnpm
        pnpm i --frozen-lockfile

    - name: Build JS Frontend 🛠️
      working-directory: ./frontend
      run: pnpm run build

    - name: Build Python Backend 🛠️
      working-directory: ./backend
      run: |
        poetry dynamic-versioning 
        DECKY_REPO="${{ github.repository }}" DECKY_BRANCH="${{ github.event.number && format('PR{0}/{1}', github.event.number, github.head_ref) || github.ref_name }}" ${{ inputs.noconsole == true && 'DECKY_NOCONSOLE=1 ' || '' }}pyinstaller pyinstaller.spec
        echo Builds:
        ls ./dist

    - name: Upload package artifact ⬆️
      if: ${{ !env.ACT }}
      uses: actions/upload-artifact@v7
      with:
        name: ${{ inputs.artifact_name }}
        path: ./backend/dist/${{ inputs.binary_name }}

    - name: Download package artifact locally
      if: ${{ env.ACT }}
      uses: actions/upload-artifact@v7
      with:
        path: ./backend/dist/${{ inputs.binary_name }}