|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v*'] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +env: |
| 11 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: macos-latest |
| 20 | + platform: macOS |
| 21 | + - os: ubuntu-latest |
| 22 | + platform: Linux |
| 23 | + - os: windows-latest |
| 24 | + platform: Windows |
| 25 | + |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v5 |
| 30 | + |
| 31 | + - uses: actions/setup-python@v6 |
| 32 | + with: |
| 33 | + python-version: '3.10' |
| 34 | + |
| 35 | + # ── System deps (Linux only) ────────────────────────────────── |
| 36 | + - name: Install system dependencies |
| 37 | + if: runner.os == 'Linux' |
| 38 | + run: | |
| 39 | + sudo apt-get update |
| 40 | + sudo apt-get install -y \ |
| 41 | + libgirepository1.0-dev gcc libcairo2-dev \ |
| 42 | + pkg-config python3-dev \ |
| 43 | + gir1.2-gtk-3.0 gir1.2-webkit2-4.1 |
| 44 | +
|
| 45 | + # ── Download python-build-standalone ────────────────────────── |
| 46 | + - name: Download python-standalone (Unix) |
| 47 | + if: runner.os != 'Windows' |
| 48 | + run: bash scripts/download_python_standalone.sh |
| 49 | + |
| 50 | + - name: Download python-standalone (Windows) |
| 51 | + if: runner.os == 'Windows' |
| 52 | + shell: pwsh |
| 53 | + run: .\scripts\download_python_standalone.ps1 |
| 54 | + |
| 55 | + # ── Build tools ─────────────────────────────────────────────── |
| 56 | + - name: Install build dependencies |
| 57 | + run: pip install -r requirements-launcher.txt pyinstaller |
| 58 | + |
| 59 | + # ── Platform builds ─────────────────────────────────────────── |
| 60 | + - name: Build (macOS) |
| 61 | + if: runner.os == 'macOS' |
| 62 | + run: | |
| 63 | + VERSION=$(cat VERSION | tr -d '[:space:]') |
| 64 | + python -m PyInstaller Ouroboros.spec --clean --noconfirm |
| 65 | + sleep 3 |
| 66 | + hdiutil create -volname Ouroboros \ |
| 67 | + -srcfolder dist/Ouroboros.app -ov -format UDZO \ |
| 68 | + "dist/Ouroboros-${VERSION}-macos.dmg" \ |
| 69 | + || { sleep 10; hdiutil create -volname Ouroboros \ |
| 70 | + -srcfolder dist/Ouroboros.app -ov -format UDZO \ |
| 71 | + "dist/Ouroboros-${VERSION}-macos.dmg"; } |
| 72 | +
|
| 73 | + - name: Build (Linux) |
| 74 | + if: runner.os == 'Linux' |
| 75 | + run: | |
| 76 | + VERSION=$(cat VERSION | tr -d '[:space:]') |
| 77 | + python -m PyInstaller Ouroboros.spec --clean --noconfirm |
| 78 | + cd dist && tar -czf "Ouroboros-${VERSION}-linux-x86_64.tar.gz" Ouroboros/ |
| 79 | +
|
| 80 | + - name: Build (Windows) |
| 81 | + if: runner.os == 'Windows' |
| 82 | + shell: pwsh |
| 83 | + run: | |
| 84 | + $Version = (Get-Content VERSION).Trim() |
| 85 | + python -m PyInstaller Ouroboros.spec --clean --noconfirm |
| 86 | + Compress-Archive -Path dist\Ouroboros -DestinationPath "dist\Ouroboros-${Version}-windows-x64.zip" -Force |
| 87 | +
|
| 88 | + # ── Upload ──────────────────────────────────────────────────── |
| 89 | + - name: Upload build artifact |
| 90 | + uses: actions/upload-artifact@v6 |
| 91 | + with: |
| 92 | + name: ouroboros-${{ matrix.platform }} |
| 93 | + path: | |
| 94 | + dist/*.dmg |
| 95 | + dist/*.tar.gz |
| 96 | + dist/*.zip |
| 97 | +
|
| 98 | + # ── GitHub Release ────────────────────────────────────────────────── |
| 99 | + release: |
| 100 | + needs: build |
| 101 | + runs-on: ubuntu-latest |
| 102 | + permissions: |
| 103 | + contents: write |
| 104 | + steps: |
| 105 | + - uses: actions/download-artifact@v7 |
| 106 | + with: |
| 107 | + merge-multiple: true |
| 108 | + path: artifacts |
| 109 | + |
| 110 | + - name: Create GitHub Release |
| 111 | + uses: softprops/action-gh-release@v2 |
| 112 | + with: |
| 113 | + files: artifacts/* |
| 114 | + generate_release_notes: true |
| 115 | + prerelease: ${{ contains(github.ref_name, '-') }} |
0 commit comments