fix(ci): use correct rust-toolchain action name #2
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 | |
| - dev | |
| permissions: | |
| contents: write | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get version from tauri.conf.json | |
| id: get_version | |
| run: | | |
| VERSION=$(jq -r '.version' src-tauri/tauri.conf.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create draft release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| name: ZeroLimit v${{ steps.get_version.outputs.version }} | |
| draft: true | |
| generate_release_notes: true | |
| build-windows-x64: | |
| needs: create-release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| src-tauri/target/ | |
| key: ${{ runner.os }}-cargo-x64-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-x64- | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| - name: Build Tauri (x64) | |
| run: pnpm tauri build --target x86_64-pc-windows-msvc | |
| - name: Upload artifacts to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.create-release.outputs.version }} | |
| draft: true | |
| files: | | |
| src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe | |
| src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe.sig | |
| src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi | |
| src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi.sig | |
| build-windows-arm64: | |
| needs: create-release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-pc-windows-msvc | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| src-tauri/target/ | |
| key: ${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-arm64- | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| - name: Build Tauri (ARM64) | |
| run: pnpm tauri build --target aarch64-pc-windows-msvc | |
| - name: Upload artifacts to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.create-release.outputs.version }} | |
| draft: true | |
| files: | | |
| src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe | |
| src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe.sig | |
| src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/*.msi | |
| src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/*.msi.sig | |
| publish-release: | |
| needs: [create-release, build-windows-x64, build-windows-arm64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download release assets | |
| uses: robinraju/release-downloader@v1 | |
| with: | |
| tag: v${{ needs.create-release.outputs.version }} | |
| fileName: "*.sig" | |
| out-file-path: signatures | |
| - name: Generate latest.json | |
| run: | | |
| VERSION="${{ needs.create-release.outputs.version }}" | |
| REPO="${{ github.repository }}" | |
| DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| # Read signature files | |
| X64_SIG=$(cat signatures/*x64*.exe.sig 2>/dev/null || echo "") | |
| ARM64_SIG=$(cat signatures/*arm64*.exe.sig 2>/dev/null || echo "") | |
| cat > latest.json << EOF | |
| { | |
| "version": "$VERSION", | |
| "notes": "See release notes on GitHub", | |
| "pub_date": "$DATE", | |
| "platforms": { | |
| "windows-x86_64": { | |
| "signature": "$X64_SIG", | |
| "url": "https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_x64-setup.exe" | |
| }, | |
| "windows-aarch64": { | |
| "signature": "$ARM64_SIG", | |
| "url": "https://github.com/$REPO/releases/download/v$VERSION/ZeroLimit_${VERSION}_arm64-setup.exe" | |
| } | |
| } | |
| } | |
| EOF | |
| - name: Upload latest.json | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.create-release.outputs.version }} | |
| draft: false | |
| files: latest.json |