enhance(actions):尝试使用tauri官方提供的Actions。
This commit is contained in:
		
							
								
								
									
										72
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										72
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -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: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user