From 600618775938289372a2b83b34dd21e8fd06492d Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Sun, 14 Jul 2024 15:28:31 +0545 Subject: [PATCH] ci: add workflows --- .github/workflows/canary.yml | 56 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 .github/workflows/canary.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml new file mode 100644 index 0000000..1848a32 --- /dev/null +++ b/.github/workflows/canary.yml @@ -0,0 +1,56 @@ +name: Canary +on: + push: + branches: + - 'canary' +jobs: + canary-release: + permissions: + contents: write + strategy: + fail-fast: true + 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-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. + args: '' + - platform: 'windows-latest' + args: '' + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install dependencies + run: bun install --frozen-lockfile + + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: yasumu-canary-__VERSION__ + releaseName: 'Yasumu Canary __VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: true + appVersion: __VERSION__-${{ github.sha }} + args: ${{ matrix.args }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..96a4b1f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'main' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + test: + strategy: + fail-fast: true + 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-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. + args: '' + - platform: 'windows-latest' + args: '' + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Build + run: bun tauri build ${{ matrix.args }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f8cc484 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release +on: + workflow_dispatch: + push: + branches: + - 'release' +jobs: + release: + permissions: + contents: write + strategy: + fail-fast: true + 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-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. + args: '' + - platform: 'windows-latest' + args: '' + + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install dependencies + run: bun install --frozen-lockfile + + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: yasumu-canary-v__VERSION__ + releaseName: 'Yasumu Canary v__VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: true + appVersion: __VERSION__-${{ github.sha }} + args: ${{ matrix.args }}