From de3511a8ddcaea3939eeef72c2492b09e249c261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Mon, 13 Mar 2023 16:41:31 +0800 Subject: [PATCH] =?UTF-8?q?enhance(actions):=E5=B0=9D=E8=AF=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8tauri=E5=AE=98=E6=96=B9=E6=8F=90=E4=BE=9B=E7=9A=84Acti?= =?UTF-8?q?ons=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 72 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8740126..e06b645 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,69 +6,65 @@ on: jobs: create-release: - runs-on: ubuntu-latest + permissions: + contents: write + runs-on: ubuntu-20.04 outputs: - RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} + release_id: ${{ steps.create-release.outputs.result }} steps: - - uses: actions/checkout@v2 - - # 查询版本号(tag) - - name: Query version number - id: get_version - shell: bash - run: | - echo "using version tag ${GITHUB_REF:10}" - echo ::set-output name=version::"${GITHUB_REF:10}" - - # 根据查询到的版本号创建 release - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - name: setup node + uses: actions/setup-node@v3 with: - tag_name: '${{ steps.get_version.outputs.VERSION }}' - release_name: 'comic_viewer ${{ steps.get_version.outputs.VERSION }}' - body: '从附件中下载对应平台的安装包以及应用。' + node-version: 16 + - name: get version + run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV + - name: create release + id: create-release + uses: actions/github-script@v6 + with: + script: | + const { data } = await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: `app-v${process.env.PACKAGE_VERSION}`, + name: `漫画阅读器 v${process.env.PACKAGE_VERSION}`, + body: '从附件中下载对应平台的安装包以及应用。', + draft: true, + prerelease: false + }) + return data.id build-tauri: needs: create-release + permissions: + contents: write strategy: fail-fast: false matrix: - platform: [macos-latest, ubuntu-latest, windows-latest] + platform: [macos-latest, ubuntu-20.04, windows-latest] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v3 - - # 安装 Node.js - - name: Setup node + - name: setup node uses: actions/setup-node@v3 with: node-version: 16 - - # 安装 Rust - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - - # 使用 Rust 缓存,加快安装速度 - - uses: Swatinem/rust-cache@v1 - + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-latest' + if: matrix.platform == 'ubuntu-20.04' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf - + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - name: install frontend dependencies - run: pnpm install # change this to npm or pnpm depending on which one you use + run: yarn install # change this to npm or pnpm depending on which one you use - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tauriScript: pnpm releaseId: ${{ needs.create-release.outputs.release_id }} publish-release: