|
| 1 | +name: Build and Release PhotoGlimmer |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + release_type: |
| 7 | + description: 'Type of release' |
| 8 | + required: true |
| 9 | + default: 'beta' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - beta |
| 13 | + - stable |
| 14 | + |
| 15 | +jobs: |
| 16 | + # 1. VERSION EXTRACTION |
| 17 | + get-version: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + version: ${{ steps.extract.outputs.version }} |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - id: extract |
| 24 | + run: | |
| 25 | + # Use the robust sed logic to pull version from Interfaces.py |
| 26 | + V=$(sed -n 's/^APP_VERSION.*=.*["'\'']\([^"'\'']*\)["'\''].*/\1/p' src/photoglimmer/backend/Interfaces.py) |
| 27 | + echo "version=$V" >> $GITHUB_OUTPUT |
| 28 | +
|
| 29 | + # 2. SNAP BUILD |
| 30 | + build-snap: |
| 31 | + needs: get-version |
| 32 | + runs-on: ubuntu-24.04 |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - name: Build Snap |
| 36 | + uses: snapcore/action-build@v1 |
| 37 | + with: |
| 38 | + path: src/ # Runs from src/ |
| 39 | + snapcraft-args: pack --destructive-mode |
| 40 | + - uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: photoglimmer-snap |
| 43 | + path: src/*.snap |
| 44 | + |
| 45 | + # 3. APPIMAGE BUILD |
| 46 | + build-appimage: |
| 47 | + needs: get-version |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + - name: Set up Python 3.12.3 |
| 52 | + uses: actions/setup-python@v5 |
| 53 | + with: |
| 54 | + python-version: '3.12.3' |
| 55 | + - name: Install System Dependencies |
| 56 | + run: | |
| 57 | + sudo apt-get update |
| 58 | + sudo apt-get install -y desktop-file-utils libgdk-pixbuf2.0-dev |
| 59 | + - name: Build AppImage |
| 60 | + working-directory: src/appimage |
| 61 | + run: | |
| 62 | + # Inject version into environment for the recipe |
| 63 | + export APP_VERSION=${{ needs.get-version.outputs.version }} |
| 64 | + python -m venv appimage_venv |
| 65 | + source appimage_venv/bin/activate |
| 66 | + pip install appimage-builder packaging==20.9 |
| 67 | + appimage-builder --recipe AppImageBuilder.yml |
| 68 | + - uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: photoglimmer-appimage |
| 71 | + path: src/appimage/*.AppImage |
| 72 | + |
| 73 | + # 4. UNIFIED RELEASE |
| 74 | + create-release: |
| 75 | + needs: [get-version, build-snap, build-appimage] |
| 76 | + runs-on: ubuntu-latest |
| 77 | + permissions: |
| 78 | + contents: write # Mandatory for creating releases |
| 79 | + steps: |
| 80 | + - name: Download Artifacts |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + path: ./release-artifacts |
| 84 | + merge-multiple: true # Flattens Snap and AppImage into one folder |
| 85 | + |
| 86 | + - name: Create GitHub Release |
| 87 | + uses: softprops/action-gh-release@v2 |
| 88 | + with: |
| 89 | + # Uses the version extracted in Job 1 as the Tag |
| 90 | + tag_name: v${{ needs.get-version.outputs.version }} |
| 91 | + name: PhotoGlimmer v${{ needs.get-version.outputs.version }} (${{ github.event.inputs.release_type }}) |
| 92 | + body: | |
| 93 | + Automated build for PhotoGlimmer version ${{ needs.get-version.outputs.version }}. |
| 94 | + Type: ${{ github.event.inputs.release_type }} |
| 95 | + draft: false |
| 96 | + prerelease: ${{ github.event.inputs.release_type == 'beta' }} |
| 97 | + files: | |
| 98 | + ./release-artifacts/*.snap |
| 99 | + ./release-artifacts/*.AppImage |
| 100 | + generate_release_notes: true |
| 101 | + |
0 commit comments