From cfd70bcf3be296c9be10560cea727bc7225eafe1 Mon Sep 17 00:00:00 2001 From: Dmitry <58977309+Mon4ik@users.noreply.github.com> Date: Sat, 20 Jul 2024 10:36:54 +0300 Subject: [PATCH] ci: changed tauri-build --- .github/workflows/publish.yml | 124 +++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 48 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 157816e..703f332 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,66 +6,94 @@ on: - "v*" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - publish-tauri: - permissions: - contents: write + build-binaries: strategy: fail-fast: false matrix: - include: - - platform: 'macos-latest' # for Arm based macs (M1 and above). - args: '--target aarch64-apple-darwin' - - platform: 'macos-latest' # for Intel based macs. - args: '--target x86_64-apple-darwin' - - platform: 'ubuntu-20.04' - args: '' - - platform: 'windows-latest' - args: '' + platform: + - os: ubuntu-latest + rust_target: x86_64-unknown-linux-gnu + - os: macos-latest + rust_target: x86_64-apple-darwin + - os: macos-latest + rust_target: aarch64-apple-darwin + - os: windows-latest + rust_target: x86_64-pc-windows-msvc - runs-on: ${{ matrix.platform }} + runs-on: ${{ matrix.platform.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' # This must match the platform value defined above. - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8 + run_install: false - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: 8 - run_install: false + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: 'pnpm' - - name: setup node - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: 'pnpm' + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: 'pnpm' - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - with: - # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. - targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + - name: 'Setup Rust' + uses: actions-rs/toolchain@v1 + with: + default: true + override: true + profile: minimal + toolchain: stable + target: ${{ matrix.platform.rust_target }} - - name: Rust cache - uses: swatinem/rust-cache@v2 - with: - workspaces: './src-tauri -> target' + - uses: Swatinem/rust-cache@v2 - - name: install frontend dependencies - run: pnpm install + - name: install dependencies (ubuntu only) + if: matrix.platform.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf - - uses: tauri-apps/tauri-action@v0 + - name: install frontend dependencies + run: pnpm install + + - uses: JonasKruckenberg/tauri-build@v1.2.2 + id: tauri_build + with: + target: ${{ matrix.platform.rust_target }} + + # The artifacts output can now be used to upload the artifacts + - uses: actions/upload-artifact@v3 + with: + name: artifacts + path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}" + + publish: + needs: build-binaries + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # Download the previously uploaded artifacts + - uses: actions/download-artifact@v3 + id: download + with: + name: artifacts + path: artifacts + # And create a release with the artifacts attached + - name: 'create release' + uses: softprops/action-gh-release@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' with: - tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: 'rsblox v__VERSION__' - releaseBody: 'See the assets to download this version and install.' - releaseDraft: true - prerelease: false - args: ${{ matrix.args }} + draft: false + files: ./artifacts/**/*