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: | jobs: | ||||||
|   create-release: |   create-release: | ||||||
|     runs-on: ubuntu-latest |     permissions: | ||||||
|  |       contents: write | ||||||
|  |     runs-on: ubuntu-20.04 | ||||||
|     outputs: |     outputs: | ||||||
|       RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} |       release_id: ${{ steps.create-release.outputs.result }} | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v2 |       - uses: actions/checkout@v3 | ||||||
|  |       - name: setup node | ||||||
|       # 查询版本号(tag) |         uses: actions/setup-node@v3 | ||||||
|       - 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 }} |  | ||||||
|         with: |         with: | ||||||
|           tag_name: '${{ steps.get_version.outputs.VERSION }}' |           node-version: 16 | ||||||
|           release_name: 'comic_viewer ${{ steps.get_version.outputs.VERSION }}' |       - name: get version | ||||||
|           body: '从附件中下载对应平台的安装包以及应用。' |         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: |   build-tauri: | ||||||
|     needs: create-release |     needs: create-release | ||||||
|  |     permissions: | ||||||
|  |       contents: write | ||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         platform: [macos-latest, ubuntu-latest, windows-latest] |         platform: [macos-latest, ubuntu-20.04, windows-latest] | ||||||
|  |  | ||||||
|     runs-on: ${{ matrix.platform }} |     runs-on: ${{ matrix.platform }} | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v3 | ||||||
|  |       - name: setup node | ||||||
|       # 安装 Node.js |  | ||||||
|       - name: Setup node |  | ||||||
|         uses: actions/setup-node@v3 |         uses: actions/setup-node@v3 | ||||||
|         with: |         with: | ||||||
|           node-version: 16 |           node-version: 16 | ||||||
|  |       - name: install Rust stable | ||||||
|       # 安装 Rust |         uses: dtolnay/rust-toolchain@stable | ||||||
|       - name: Install Rust nightly |  | ||||||
|         uses: dtolnay/rust-toolchain@nightly |  | ||||||
|  |  | ||||||
|       # 使用 Rust 缓存,加快安装速度 |  | ||||||
|       - uses: Swatinem/rust-cache@v1 |  | ||||||
|  |  | ||||||
|       - name: install dependencies (ubuntu only) |       - name: install dependencies (ubuntu only) | ||||||
|         if: matrix.platform == 'ubuntu-latest' |         if: matrix.platform == 'ubuntu-20.04' | ||||||
|         run: | |         run: | | ||||||
|           sudo apt-get update |           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 |       - 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 |       - uses: tauri-apps/tauri-action@v0 | ||||||
|         env: |         env: | ||||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|         with: |         with: | ||||||
|           tauriScript: pnpm |  | ||||||
|           releaseId: ${{ needs.create-release.outputs.release_id }} |           releaseId: ${{ needs.create-release.outputs.release_id }} | ||||||
|  |  | ||||||
|   publish-release: |   publish-release: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user