Skip to content
Snippets Groups Projects
ci.yml 2.6 KiB
Newer Older
GyDi's avatar
GyDi committed
name: Release CI
GyDi's avatar
GyDi committed

GyDi's avatar
GyDi committed
on:
GyDi's avatar
GyDi committed
  workflow_dispatch:
GyDi's avatar
GyDi committed
  push:
    tags:
      - v**
GyDi's avatar
GyDi committed

env:
  CARGO_INCREMENTAL: 0
  RUST_BACKTRACE: short

jobs:
  release:
GyDi's avatar
GyDi committed
    strategy:
      matrix:
GyDi's avatar
GyDi committed
        os: [windows-latest, ubuntu-20.04, macos-latest]
GyDi's avatar
GyDi committed
    runs-on: ${{ matrix.os }}
GyDi's avatar
GyDi committed
    if: startsWith(github.repository, 'zzzgydi')
GyDi's avatar
GyDi committed
    steps:
      - name: Checkout repository
GyDi's avatar
GyDi committed
        uses: actions/checkout@v3
GyDi's avatar
GyDi committed

GyDi's avatar
GyDi committed
      - name: install Rust stable
        uses: dtolnay/rust-toolchain@stable
GyDi's avatar
GyDi committed

      - name: Rust Cache
GyDi's avatar
GyDi committed
        uses: Swatinem/rust-cache@v2
GyDi's avatar
GyDi committed
        with:
GyDi's avatar
GyDi committed
          workspaces: src-tauri
GyDi's avatar
GyDi committed

      - name: Install Node
GyDi's avatar
GyDi committed
        uses: actions/setup-node@v3
GyDi's avatar
GyDi committed
        with:
GyDi's avatar
GyDi committed
          node-version: "16"
          cache: "yarn"
GyDi's avatar
GyDi committed

GyDi's avatar
GyDi committed
      - name: Install Dependencies (ubuntu only)
GyDi's avatar
GyDi committed
        if: startsWith(matrix.os, 'ubuntu-')
GyDi's avatar
GyDi committed
        run: |
GyDi's avatar
GyDi committed
          sudo apt-get update
          sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf openssl
GyDi's avatar
GyDi committed

GyDi's avatar
GyDi committed
      - name: Yarn install and check
GyDi's avatar
GyDi committed
        run: |
GyDi's avatar
GyDi committed
          yarn install --network-timeout 1000000 --frozen-lockfile
GyDi's avatar
GyDi committed
          yarn run check
GyDi's avatar
GyDi committed

      - name: Tauri build
GyDi's avatar
GyDi committed
        uses: tauri-apps/tauri-action@v0
GyDi's avatar
GyDi committed
        # enable cache even though failed
GyDi's avatar
GyDi committed
        # continue-on-error: true
GyDi's avatar
GyDi committed
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GyDi's avatar
GyDi committed
          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
GyDi's avatar
GyDi committed
        with:
          tagName: v__VERSION__
          releaseName: "Clash Verge v__VERSION__"
GyDi's avatar
GyDi committed
          releaseBody: "More new features are now supported."
GyDi's avatar
GyDi committed
          releaseDraft: false
          prerelease: true
GyDi's avatar
GyDi committed
      - name: Portable Bundle
GyDi's avatar
GyDi committed
        if: startsWith(matrix.os, 'windows-')
        # rebuild with env settings
GyDi's avatar
GyDi committed
        run: |
GyDi's avatar
GyDi committed
          yarn run portable
GyDi's avatar
GyDi committed
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
          VITE_WIN_PORTABLE: 1
GyDi's avatar
GyDi committed

GyDi's avatar
GyDi committed
  release-update:
    needs: release
GyDi's avatar
GyDi committed
    runs-on: ubuntu-latest
GyDi's avatar
GyDi committed
    if: |
      startsWith(github.repository, 'zzzgydi') &&
      startsWith(github.ref, 'refs/tags/v')
    steps:
      - name: Checkout repository
GyDi's avatar
GyDi committed
        uses: actions/checkout@v3
GyDi's avatar
GyDi committed
      - name: Install Node
        uses: actions/setup-node@v3
        with:
GyDi's avatar
GyDi committed
          node-version: "16"
          cache: "yarn"

      - name: Yarn install
GyDi's avatar
GyDi committed
        run: yarn install --network-timeout 1000000 --frozen-lockfile
      - name: Release updater file
        run: yarn run updater
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}