ci(release): ad-hoc signing + Intel macOS OpenSSL fix #3
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 | |
| # Triggered by pushing a version tag (e.g. v0.2.0). | |
| # The release.sh script creates these tags. | |
| # | |
| # This workflow builds signed installers for all platforms and creates a | |
| # GitHub Release with the artifacts attached. | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| NODE_VERSION: 20 | |
| jobs: | |
| # ── 1. Build the extension host (platform-agnostic TypeScript) ── | |
| build-extension-host: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| cache-dependency-path: extension-host/package-lock.json | |
| - name: Build extension host | |
| run: | | |
| cd extension-host | |
| npm ci | |
| npm run build | |
| - name: Upload extension-host dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extension-host-dist | |
| path: extension-host/dist/** | |
| if-no-files-found: error | |
| # ── 2. Build Tauri app for each platform ── | |
| release: | |
| needs: [build-extension-host] | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| target: 'aarch64-apple-darwin' | |
| args: '--target aarch64-apple-darwin' | |
| - platform: 'macos-latest' | |
| target: 'x86_64-apple-darwin' | |
| args: '--target x86_64-apple-darwin' | |
| - platform: 'ubuntu-22.04' | |
| target: 'x86_64-unknown-linux-gnu' | |
| args: '' | |
| - platform: 'windows-latest' | |
| target: 'x86_64-pc-windows-msvc' | |
| # jemalloc (tikv-jemalloc-sys) does not build on Windows | |
| args: '-- --no-default-features' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| # Work around dtolnay/rust-toolchain@stable bug on Windows where | |
| # an internal grep step exits with code 1 due to bash -e. | |
| # Rust is pre-installed on GitHub Actions runners, so this is safe. | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| continue-on-error: ${{ matrix.platform == 'windows-latest' }} | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Verify Rust installation | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| rustc --version | |
| cargo --version | |
| shell: bash | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install Tauri dependencies (Ubuntu) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev | |
| # Intel macOS cross-compilation requires x86_64 Homebrew OpenSSL | |
| - name: Install x86_64 OpenSSL (macOS Intel cross-build) | |
| if: matrix.target == 'x86_64-apple-darwin' | |
| run: | | |
| arch -x86_64 /usr/local/bin/brew install openssl@3 || true | |
| echo "OPENSSL_DIR=$(arch -x86_64 /usr/local/bin/brew --prefix openssl@3 2>/dev/null || echo /usr/local/opt/openssl@3)" >> "$GITHUB_ENV" | |
| shell: bash | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Download extension-host dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: extension-host-dist | |
| path: extension-host/dist | |
| - name: Download Node.js for external binary | |
| run: bash ./scripts/download-node.sh --all | |
| # Ad-hoc codesigning on macOS prevents "damaged" Gatekeeper errors | |
| # on Apple Silicon. Will be replaced with proper Developer ID signing | |
| # once an Apple Developer account is available. | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CODESIGN_IDENTITY: ${{ matrix.platform == 'macos-latest' && '-' || '' }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'DSCode ${{ github.ref_name }}' | |
| releaseBody: | | |
| ## What's New | |
| See the [CHANGELOG](../blob/main/CHANGELOG.md) for full details. | |
| ## Assets | |
| Download the installer for your platform below: | |
| - **macOS (Apple Silicon)**: `.dmg` | |
| - **macOS (Intel)**: `.dmg` | |
| - **Linux (x86_64)**: `.deb` or `.AppImage` | |
| - **Windows (x86_64)**: `.msi` or `.exe` | |
| releaseDraft: true | |
| prerelease: false | |
| args: ${{ matrix.args }} |