|
| 1 | +name: CircuitVerse Simulator Desktop Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-tauri: |
| 9 | + name: Build Tauri App |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout Repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + # Node 22 is used in CircuitVerse's primary code base |
| 21 | + - name: Setup Node.js |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: 22 |
| 25 | + |
| 26 | + - name: Cache Node.js Dependencies |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ~/.npm |
| 30 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 31 | + restore-keys: ${{ runner.os }}-node- |
| 32 | + |
| 33 | + - name: Install npm Dependencies |
| 34 | + run: npm install |
| 35 | + |
| 36 | + - name: Run Pre-Build Script |
| 37 | + run: node build-desktop.js |
| 38 | + |
| 39 | + - name: Setup Rust (Non-Windows) |
| 40 | + if: matrix.os != 'windows-latest' |
| 41 | + run: | |
| 42 | + rustup update stable |
| 43 | + rustup default stable |
| 44 | +
|
| 45 | + - name: Install OS-Specific Dependencies (Ubuntu) |
| 46 | + if: matrix.os == 'ubuntu-latest' |
| 47 | + run: | |
| 48 | + sudo apt update |
| 49 | + sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev |
| 50 | +
|
| 51 | + - name: Install OS-Specific Dependencies (macOS) |
| 52 | + if: matrix.os == 'macos-latest' |
| 53 | + run: | |
| 54 | + brew update |
| 55 | + brew install pkg-config |
| 56 | +
|
| 57 | + - name: Cache Rust Dependencies |
| 58 | + uses: Swatinem/rust-cache@v2 |
| 59 | + with: |
| 60 | + workspaces: "./src-tauri" |
| 61 | + |
| 62 | + - name: Build Tauri App |
| 63 | + run: npm run tauri build |
| 64 | + |
| 65 | + - name: Upload Build Artifacts |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: Tauri Build Artifacts (${{ matrix.os }}) |
| 69 | + path: src-tauri/target/release/bundle |
| 70 | + |
| 71 | + create-release: |
| 72 | + name: Create GitHub Release |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: build-tauri |
| 75 | + steps: |
| 76 | + - name: Download Build Artifacts |
| 77 | + uses: actions/download-artifact@v4 |
| 78 | + with: |
| 79 | + path: artifacts |
| 80 | + |
| 81 | + - name: Install GitHub CLI |
| 82 | + run: | |
| 83 | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg |
| 84 | + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null |
| 85 | + sudo apt update |
| 86 | + sudo apt install gh -y |
| 87 | +
|
| 88 | + - name: Create GitHub Release |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + run: | |
| 92 | + gh release create "${{ github.ref_name }}" \ |
| 93 | + --title "Release ${{ github.ref_name }}" \ |
| 94 | + --notes "Official CircuitVerse Simulator Desktop Release ${{ github.ref_name }}. Download the binaries below." \ |
| 95 | + artifacts/Tauri\ Build\ Artifacts\ \(ubuntu-latest\)/* \ |
| 96 | + artifacts/Tauri\ Build\ Artifacts\ \(windows-latest\)/* \ |
| 97 | + artifacts/Tauri\ Build\ Artifacts\ \(macos-latest\)/* |
0 commit comments