| @@ -2,13 +2,10 @@ name: Publish Desktop App · 1 unmodified line |
| 2 | run-name: "${{ format('publish desktop {0}', github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name) }}" | 2 | run-name: "${{ format('publish desktop {0}', github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name) }}" |
| 3 | | 3 | |
| 4 | on: | 4 | on: |
| 5 | push: | | |
| 6 | tags: | | |
| 7 | - "v*" | | |
| 8 | workflow_dispatch: | 5 | workflow_dispatch: |
| 9 | inputs: | 6 | inputs: |
| 10 | tag: | 7 | tag: |
| 11 | description: Git tag to publish | 8 | description: Git tag to publish (e.g. v1.4.1) |
| 12 | required: true | 9 | required: true |
| 13 | type: string | 10 | type: string |
| 14 | | 11 | |
| @@ -28,15 +25,19 @@ jobs: · 13 unmodified lines |
| 28 | - os: macos-latest | 25 | - os: macos-latest |
| 29 | arch: arm64 | 26 | arch: arm64 |
| 30 | platform: mac | 27 | platform: mac |
| | 28 | cli-asset: executor-darwin-arm64.zip |
| 31 | - os: macos-latest | 29 | - os: macos-latest |
| 32 | arch: x64 | 30 | arch: x64 |
| 33 | platform: mac | 31 | platform: mac |
| | 32 | cli-asset: executor-darwin-x64.zip |
| 34 | - os: ubuntu-latest | 33 | - os: ubuntu-latest |
| 35 | arch: x64 | 34 | arch: x64 |
| 36 | platform: linux | 35 | platform: linux |
| | 36 | cli-asset: executor-linux-x64.tar.gz |
| 37 | - os: windows-latest | 37 | - os: windows-latest |
| 38 | arch: x64 | 38 | arch: x64 |
| 39 | platform: win | 39 | platform: win |
| | 40 | cli-asset: executor-windows-x64.zip |
| 40 | | 41 | |
| 41 | runs-on: ${{ matrix.os }} | 42 | runs-on: ${{ matrix.os }} |
| 42 | | 43 | |
| @@ -44,7 +45,7 @@ jobs: · 1 unmodified line |
| 44 | - name: Checkout | 45 | - name: Checkout |
| 45 | uses: actions/checkout@v4 | 46 | uses: actions/checkout@v4 |
| 46 | with: | 47 | with: |
| 47 | ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.ref }} | 48 | ref: refs/tags/${{ inputs.tag }} |
| 48 | | 49 | |
| 49 | - name: Setup Bun | 50 | - name: Setup Bun |
| 50 | uses: oven-sh/setup-bun@v2 | 51 | uses: oven-sh/setup-bun@v2 |
| @@ -63,54 +64,60 @@ jobs: · 12 unmodified lines |
| 63 | run: bun run build | 64 | run: bun run build |
| 64 | working-directory: apps/web | 65 | working-directory: apps/web |
| 65 | | 66 | |
| 66 | - name: Build CLI sidecar binary | 67 | - name: Download CLI binary from release |
| 67 | run: bun run src/build.ts binary --single | 68 | env: |
| 68 | working-directory: apps/cli | 69 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | | | |
| 70 | - name: Copy sidecar to desktop resources | | |
| 71 | shell: bash | | |
| 72 | run: | | 70 | run: | |
| 73 | mkdir -p apps/desktop/resources | 71 | mkdir -p apps/desktop/resources |
| 74 | if [ "${{ matrix.platform }}" = "win" ]; then | 72 | gh release download "${{ inputs.tag }}" \ |
| 75 | BINARY_NAME="executor.exe" | 73 | --repo "${{ github.repository }}" \ |
| | 74 | --pattern "${{ matrix.cli-asset }}" \ |
| | 75 | --dir /tmp/cli-download |
| | 76 | |
| | 77 | - name: Extract CLI sidecar (unix) |
| | 78 | if: matrix.platform != 'win' |
| | 79 | run: | |
| | 80 | cd /tmp/cli-download |
| | 81 | if [[ "${{ matrix.cli-asset }}" == *.tar.gz ]]; then |
| | 82 | tar -xzf "${{ matrix.cli-asset }}" |
| 76 | else | 83 | else |
| 77 | BINARY_NAME="executor" | 84 | unzip -o "${{ matrix.cli-asset }}" |
| 78 | fi | 85 | fi |
| 79 | | 86 | cp executor apps/desktop/resources/executor |
| 80 | PLATFORM="${{ matrix.platform == 'mac' && 'darwin' || matrix.platform == 'win' && 'windows' || 'linux' }}" | 87 | chmod +x apps/desktop/resources/executor |
| 81 | ARCH="${{ matrix.arch }}" | 88 | if [ -f emscripten-module.wasm ]; then |
| 82 | SRC="apps/cli/dist/executor-${PLATFORM}-${ARCH}/bin" | 89 | cp emscripten-module.wasm apps/desktop/resources/ |
| 83 | | | |
| 84 | cp "${SRC}/${BINARY_NAME}" "apps/desktop/resources/${BINARY_NAME}" | | |
| 85 | chmod +x "apps/desktop/resources/${BINARY_NAME}" 2>/dev/null || true | | |
| 86 | | | |
| 87 | if [ -f "${SRC}/emscripten-module.wasm" ]; then | | |
| 88 | cp "${SRC}/emscripten-module.wasm" "apps/desktop/resources/" | | |
| 89 | fi | 90 | fi |
| | 91 | working-directory: ${{ github.workspace }} |
| | 92 | |
| | 93 | - name: Extract CLI sidecar (windows) |
| | 94 | if: matrix.platform == 'win' |
| | 95 | shell: pwsh |
| | 96 | run: | |
| | 97 | Expand-Archive -Path "/tmp/cli-download/${{ matrix.cli-asset }}" -DestinationPath "/tmp/cli-extract" -Force |
| | 98 | Copy-Item "/tmp/cli-extract/executor.exe" "apps/desktop/resources/executor.exe" |
| | 99 | if (Test-Path "/tmp/cli-extract/emscripten-module.wasm") { |
| | 100 | Copy-Item "/tmp/cli-extract/emscripten-module.wasm" "apps/desktop/resources/" |
| | 101 | } |
| 90 | | 102 | |
| 91 | - name: Build desktop app (TypeScript) | 103 | - name: Build desktop app (TypeScript) |
| 92 | run: bunx tsc -p tsconfig.json | 104 | run: bunx tsc -p tsconfig.json |
| 93 | working-directory: apps/desktop | 105 | working-directory: apps/desktop |
| 94 | | 106 | |
| 95 | - name: Build desktop distributables | 107 | - name: Build desktop distributables |
| 96 | env: | 108 | run: npx electron-builder --${{ matrix.platform }} --${{ matrix.arch }} --dir |
| 97 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | | |
| 98 | run: | | | |
| 99 | npx electron-builder --${{ matrix.platform }} --${{ matrix.arch }} --dir | | |
| 100 | working-directory: apps/desktop | 109 | working-directory: apps/desktop |
| 101 | | 110 | |
| 102 | - name: Package artifacts (macOS) | 111 | - name: Package (macOS) |
| 103 | if: matrix.platform == 'mac' | 112 | if: matrix.platform == 'mac' |
| 104 | working-directory: apps/desktop/dist | 113 | working-directory: apps/desktop/dist |
| 105 | run: | | 114 | run: | |
| 106 | # Find the .app and zip it | | |
| 107 | APP_DIR=$(find . -name "*.app" -maxdepth 2 | head -1) | 115 | APP_DIR=$(find . -name "*.app" -maxdepth 2 | head -1) |
| 108 | if [ -n "$APP_DIR" ]; then | 116 | if [ -n "$APP_DIR" ]; then |
| 109 | ZIP_NAME="Executor-${{ matrix.arch }}-mac.zip" | 117 | ditto -c -k --sequesterRsrc --keepParent "$APP_DIR" "Executor-${{ matrix.arch }}-mac.zip" |
| 110 | ditto -c -k --sequesterRsrc --keepParent "$APP_DIR" "$ZIP_NAME" | | |
| 111 | fi | 118 | fi |
| 112 | | 119 | |
| 113 | - name: Package artifacts (Linux) | 120 | - name: Package (Linux) |
| 114 | if: matrix.platform == 'linux' | 121 | if: matrix.platform == 'linux' |
| 115 | working-directory: apps/desktop/dist | 122 | working-directory: apps/desktop/dist |
| 116 | run: | | 123 | run: | |
| @@ -119,7 +126,7 @@ jobs: · 2 unmodified lines |
| 119 | tar -czf "Executor-x64-linux.tar.gz" -C "$UNPACKED" . | 126 | tar -czf "Executor-x64-linux.tar.gz" -C "$UNPACKED" . |
| 120 | fi | 127 | fi |
| 121 | | 128 | |
| 122 | - name: Package artifacts (Windows) | 129 | - name: Package (Windows) |
| 123 | if: matrix.platform == 'win' | 130 | if: matrix.platform == 'win' |
| 124 | working-directory: apps/desktop/dist | 131 | working-directory: apps/desktop/dist |
| 125 | shell: pwsh | 132 | shell: pwsh |
| @@ -134,8 +141,8 @@ jobs: · 8 unmodified lines |
| 134 | with: | 141 | with: |
| 135 | name: desktop-${{ matrix.platform }}-${{ matrix.arch }} | 142 | name: desktop-${{ matrix.platform }}-${{ matrix.arch }} |
| 136 | path: | | 143 | path: | |
| 137 | apps/desktop/dist/*.zip | 144 | apps/desktop/dist/Executor-*.zip |
| 138 | apps/desktop/dist/*.tar.gz | 145 | apps/desktop/dist/Executor-*.tar.gz |
| 139 | if-no-files-found: warn | 146 | if-no-files-found: warn |
| 140 | | 147 | |
| 141 | release: | 148 | release: |
| @@ -149,26 +156,11 @@ jobs: · 7 unmodified lines |
| 149 | path: artifacts | 156 | path: artifacts |
| 150 | merge-multiple: true | 157 | merge-multiple: true |
| 151 | | 158 | |
| 152 | - name: List artifacts | | |
| 153 | run: find artifacts -type f | head -20 | | |
| 154 | | | |
| 155 | - name: Upload to GitHub Release | 159 | - name: Upload to GitHub Release |
| 156 | env: | 160 | env: |
| 157 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | 161 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 158 | TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | | |
| 159 | run: | | 162 | run: | |
| 160 | # Wait for the CLI release to create the GitHub release first | | |
| 161 | for i in $(seq 1 30); do | | |
| 162 | if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | | |
| 163 | echo "Release $TAG found" | | |
| 164 | break | | |
| 165 | fi | | |
| 166 | echo "Waiting for release $TAG to be created... ($i/30)" | | |
| 167 | sleep 10 | | |
| 168 | done | | |
| 169 | | | |
| 170 | # Upload desktop artifacts | | |
| 171 | find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" \) | while read file; do | 163 | find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" \) | while read file; do |
| 172 | echo "Uploading: $file" | 164 | echo "Uploading: $file" |
| 173 | gh release upload "$TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber || true | 165 | gh release upload "${{ inputs.tag }}" "$file" --repo "${{ github.repository }}" --clobber || true |
| 174 | done | 166 | done |