Desktop GUI Release #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Desktop GUI Release | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| on: | |
| push: | |
| tags: | |
| - "gui-v*" | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: "Tag name to publish (example: gui-v1.0.0). If empty, tag is auto-read from project configuration." | |
| required: false | |
| type: string | |
| publish: | |
| description: "Publish GitHub release" | |
| required: false | |
| default: true | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-desktop-gui: | |
| name: Build GUI for ${{ matrix.platform }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| platform: windows | |
| archive-name: lion-vpn-windows.zip | |
| - os: ubuntu-latest | |
| platform: linux | |
| archive-name: lion-vpn-linux.tar.gz | |
| - os: macos-latest | |
| platform: macos | |
| archive-name: lion-vpn-macos.zip | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "jetbrains" | |
| java-version: "21" | |
| cache: "gradle" | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install Python build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt pyinstaller | |
| - name: Bundle Python Executable into Compose Resources | |
| shell: bash | |
| run: | | |
| python cmp/bundle_for_gui.py --force | |
| - name: Build Desktop Application Distributable | |
| shell: bash | |
| working-directory: cmp | |
| run: | | |
| chmod +x gradlew | |
| ./gradlew :desktopApp:createDistributableForCurrentOS --no-daemon | |
| - name: Compress Distributable | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.platform }}" = "windows" ]; then | |
| powershell -Command "Compress-Archive -Path cmp/desktopApp/build/compose/binaries/main/app -DestinationPath ${{ matrix.archive-name }}" | |
| elif [ "${{ matrix.platform }}" = "linux" ]; then | |
| tar -czf ${{ matrix.archive-name }} -C cmp/desktopApp/build/compose/binaries/main app | |
| elif [ "${{ matrix.platform }}" = "macos" ]; then | |
| cd cmp/desktopApp/build/compose/binaries/main/app | |
| zip -r -y ../../../../../../../${{ matrix.archive-name }} lion-vpn.app | |
| fi | |
| - name: Upload Compressed Distributable Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gui-${{ matrix.platform }} | |
| path: ${{ matrix.archive-name }} | |
| if-no-files-found: error | |
| publish-gui-release: | |
| name: Publish GUI Release | |
| runs-on: ubuntu-latest | |
| needs: build-desktop-gui | |
| if: always() && !cancelled() && (startsWith(github.ref, 'refs/tags/gui-v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')) | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Resolve Release Tag | |
| id: resolve_tag | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/gui-v* ]]; then | |
| TAG_NAME="${{ github.ref_name }}" | |
| elif [[ -n "${{ github.event.inputs.release_tag }}" ]]; then | |
| TAG_NAME="${{ github.event.inputs.release_tag }}" | |
| else | |
| # Extract from cmp/project-config.gradle.kts | |
| VERSION=$(grep 'versionName' cmp/project-config.gradle.kts | cut -d'"' -f2) | |
| TAG_NAME="gui-v$VERSION" | |
| fi | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "Using release tag: $TAG_NAME" | |
| - name: Download all built artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: final-gui-assets | |
| - name: Flatten directories | |
| run: | | |
| mkdir -p release-dist | |
| find final-gui-assets -type f -exec cp {} release-dist/ \; | |
| echo "Files to publish:" | |
| ls -lah release-dist | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.resolve_tag.outputs.tag_name }} | |
| files: release-dist/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| name: "GUI Release ${{ steps.resolve_tag.outputs.tag_name }}" |