Build and Release #11
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: Build and Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| args: '--target universal-apple-darwin' | |
| name: 'macOS Universal' | |
| - platform: 'ubuntu-22.04' | |
| args: '' | |
| name: 'Linux' | |
| - platform: 'windows-latest' | |
| args: '' | |
| name: 'Windows' | |
| runs-on: ${{ matrix.platform }} | |
| name: Build - ${{ matrix.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Rust cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './apps/desktop/src-tauri -> target' | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| - name: Build ttyd for macOS | |
| if: matrix.platform == 'macos-latest' | |
| run: | | |
| brew install cmake libwebsockets libevent jansson json-c openssl@3 libuv | |
| chmod +x ./scripts/build-ttyd-macos-ci.sh | |
| ./scripts/build-ttyd-macos-ci.sh | |
| # Verify ttyd was built successfully | |
| echo "Checking for ttyd binary..." | |
| pwd | |
| ls -la apps/desktop/src-tauri/resources/macos/ | |
| if [ ! -f "apps/desktop/src-tauri/resources/macos/ttyd" ]; then | |
| echo "ERROR: ttyd binary was not created!" | |
| echo "Looking for ttyd in build directory..." | |
| find . -name "ttyd" -type f | head -20 | |
| exit 1 | |
| fi | |
| echo "ttyd binary size: $(stat -f%z apps/desktop/src-tauri/resources/macos/ttyd) bytes" | |
| - name: Download binaries | |
| run: | | |
| chmod +x ./scripts/download-binaries.sh | |
| ./scripts/download-binaries.sh | |
| shell: bash | |
| - name: Verify binaries before Tauri build (Unix) | |
| if: matrix.platform != 'windows-latest' | |
| run: | | |
| echo "Checking binaries in resources directory:" | |
| find apps/desktop/src-tauri/resources -type f -name "ttyd*" -o -name "cloudflared*" | while read f; do | |
| echo "$f: $(file "$f") - Size: $(stat -f%z "$f" 2>/dev/null || stat -c%s "$f" 2>/dev/null) bytes" | |
| done | |
| - name: Verify binaries before Tauri build (Windows) | |
| if: matrix.platform == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| Write-Host "Checking binaries in resources directory:" | |
| Get-ChildItem -Path "apps/desktop/src-tauri/resources" -Recurse -Include "ttyd*", "cloudflared*" | ForEach-Object { | |
| Write-Host "$($_.FullName): $($_.Length) bytes" | |
| } | |
| - name: Build Tauri App | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Tauri updater keys (optional - only needed if using auto-updater) | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY || '' }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD || '' }} | |
| with: | |
| projectPath: apps/desktop | |
| args: ${{ matrix.args }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-${{ matrix.platform }} | |
| path: | | |
| apps/desktop/src-tauri/target/release/bundle/**/*.deb | |
| apps/desktop/src-tauri/target/release/bundle/**/*.AppImage | |
| apps/desktop/src-tauri/target/release/bundle/**/*.exe | |
| apps/desktop/src-tauri/target/release/bundle/**/*.msi | |
| apps/desktop/src-tauri/target/universal-apple-darwin/release/bundle/**/*.dmg | |
| apps/desktop/src-tauri/target/universal-apple-darwin/release/bundle/**/*.app.tar.gz | |
| retention-days: 7 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: true | |
| files: | | |
| artifacts/**/dmg/*.dmg | |
| artifacts/**/nsis/*.exe | |
| artifacts/**/msi/*.msi | |
| artifacts/**/deb/*.deb | |
| artifacts/**/appimage/*.AppImage | |
| artifacts/**/macos/*.app.tar.gz | |
| body: | | |
| # CodeTunnel Release | |
| ## What's New | |
| - | |
| ## Downloads | |
| - **macOS**: Download the `.dmg` file (Universal - works on Intel and Apple Silicon) | |
| - **Windows**: Download the `.msi` or `.exe` installer | |
| - **Linux**: Download the `.AppImage` (portable) or `.deb` (Debian/Ubuntu) | |
| ## Installation | |
| See the [README](https://github.com/${{ github.repository }}/blob/main/README.md#installation) for detailed instructions. | |
| ## Changelog | |
| See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for detailed changes. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |