Include src/ scripts in per-platform ui-bundle release zips (#3) #4
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: release | |
| on: | |
| push: | |
| tags: ["v*"] | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| cli-bundle: | |
| runs-on: ubuntu-latest | |
| needs: create-release | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Compute version | |
| id: vars | |
| run: | | |
| echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| - name: Build CLI release zip | |
| run: | | |
| rm -rf release | |
| mkdir -p release/ok_computer-cli | |
| cp README.md LICENSE VERSION .env.example okc install_okc.sh release/ok_computer-cli/ | |
| cp -R src release/ok_computer-cli/src | |
| cd release | |
| zip -qr "ok_computer-cli-${{ steps.vars.outputs.tag }}.zip" ok_computer-cli | |
| - name: Upload CLI zip to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/ok_computer-cli-${{ steps.vars.outputs.tag }}.zip | |
| ui-bundle: | |
| needs: create-release | |
| permissions: | |
| contents: write | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| asset_suffix: macos | |
| - os: ubuntu-latest | |
| asset_suffix: linux | |
| - os: windows-latest | |
| asset_suffix: windows | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install UI build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r ui/requirements.txt -r ui/requirements.conf | |
| - name: Compute version | |
| id: vars | |
| shell: bash | |
| run: | | |
| echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| - name: Build UI bundle | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then SEP=';'; else SEP=':'; fi | |
| cd ui | |
| ICON_ARGS=() | |
| if [[ "${{ matrix.os }}" == "macos-latest" && -f "assets/logo.icns" ]]; then | |
| ICON_ARGS=(--icon "assets/logo.icns") | |
| fi | |
| python -m PyInstaller --name ok_computer_ui --onedir --noconfirm --clean \ | |
| --noconsole \ | |
| "${ICON_ARGS[@]}" \ | |
| --add-data "../.env.example${SEP}." \ | |
| --add-data "templates${SEP}templates" \ | |
| --add-data "static${SEP}static" \ | |
| --add-data "../src${SEP}src" \ | |
| --collect-submodules flask \ | |
| --hidden-import socket \ | |
| --hidden-import webview \ | |
| --hidden-import webview.platforms.cocoa \ | |
| --hidden-import webview.platforms.winforms \ | |
| app.py | |
| - name: Archive macOS app | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mkdir -p release staging | |
| cp -R ui/dist/ok_computer_ui.app staging/ | |
| cp -R src staging/src | |
| ditto -c -k --sequesterRsrc staging release/ok_computer-ui-${{ matrix.asset_suffix }}-${{ steps.vars.outputs.tag }}.zip | |
| - name: Archive Linux bundle | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p release staging | |
| cp -R ui/dist/ok_computer_ui staging/ | |
| cp -R src staging/src | |
| cd staging | |
| zip -qr ../release/ok_computer-ui-${{ matrix.asset_suffix }}-${{ steps.vars.outputs.tag }}.zip . | |
| - name: Archive Windows bundle | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path release, staging | Out-Null | |
| Copy-Item -Recurse ui/dist/ok_computer_ui staging/ok_computer_ui | |
| Copy-Item -Recurse src staging/src | |
| Compress-Archive -Path staging/* -DestinationPath release/ok_computer-ui-${{ matrix.asset_suffix }}-${{ steps.vars.outputs.tag }}.zip -Force | |
| - name: Upload UI bundle to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/ok_computer-ui-${{ matrix.asset_suffix }}-${{ steps.vars.outputs.tag }}.zip |