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