build(action):测试精简的Actions.
This commit is contained in:
		
							
								
								
									
										80
									
								
								.github/workflows/alpha-release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										80
									
								
								.github/workflows/alpha-release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -3,39 +3,7 @@ on: | |||||||
|   workflow_dispatch: |   workflow_dispatch: | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   create-release: |  | ||||||
|     permissions: |  | ||||||
|       contents: write |  | ||||||
|     runs-on: ubuntu-20.04 |  | ||||||
|     outputs: |  | ||||||
|       release_id: ${{ steps.create-release.outputs.result }} |  | ||||||
|  |  | ||||||
|     steps: |  | ||||||
|       - uses: actions/checkout@v3 |  | ||||||
|       - name: setup node |  | ||||||
|         uses: actions/setup-node@v3 |  | ||||||
|         with: |  | ||||||
|           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}-alpha`, |  | ||||||
|               name: `漫画阅读器 v${process.env.PACKAGE_VERSION}`, |  | ||||||
|               body: '从附件中下载对应平台的安装包以及应用。', |  | ||||||
|               draft: true, |  | ||||||
|               prerelease: true |  | ||||||
|             }) |  | ||||||
|             return data.id |  | ||||||
|  |  | ||||||
|   build-tauri: |   build-tauri: | ||||||
|     needs: create-release |  | ||||||
|     permissions: |     permissions: | ||||||
|       contents: write |       contents: write | ||||||
|     strategy: |     strategy: | ||||||
| @@ -45,48 +13,44 @@ jobs: | |||||||
|  |  | ||||||
|     runs-on: ${{ matrix.platform }} |     runs-on: ${{ matrix.platform }} | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - name: Checkout repository | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|  |       - name: Install dependencies (ubuntu only) | ||||||
|  |         if: matrix.platform == 'ubuntu-20.04' | ||||||
|  |         run: | | ||||||
|  |           sudo apt-get update | ||||||
|  |           sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev | ||||||
|  |  | ||||||
|       - name: setup node |       - 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 |  | ||||||
|  |       - name: install Rust nightly | ||||||
|         uses: dtolnay/rust-toolchain@nightly |         uses: dtolnay/rust-toolchain@nightly | ||||||
|  |  | ||||||
|       - name: install dependencies (ubuntu only) |       - name: install dependencies (ubuntu only) | ||||||
|         if: matrix.platform == 'ubuntu-20.04' |         if: matrix.platform == 'ubuntu-20.04' | ||||||
|         run: | |         run: | | ||||||
|           sudo apt-get update |           sudo apt-get update | ||||||
|           sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf |           sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | ||||||
|  |  | ||||||
|       - uses: pnpm/action-setup@v2 |       - uses: pnpm/action-setup@v2 | ||||||
|         with: |         with: | ||||||
|           version: latest-7 |           version: latest-7 | ||||||
|  |  | ||||||
|       - name: install frontend dependencies |       - name: install frontend dependencies | ||||||
|         run: pnpm install # change this to npm or pnpm depending on which one you use |         run: pnpm install # change this to npm or pnpm depending on which one you use | ||||||
|       - uses: tauri-apps/tauri-action@v0 |  | ||||||
|  |       - name: build app | ||||||
|  |         uses: tauri-apps/tauri-action@v0 | ||||||
|         env: |         env: | ||||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|         with: |         with: | ||||||
|           tauriScript: pnpm tauri |           tauriScript: pnpm tauri | ||||||
|           releaseId: ${{ needs.create-release.outputs.release_id }} |           tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags. | ||||||
|  |           releaseName: '漫画阅读器  v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version. | ||||||
|   publish-release: |           releaseBody: '从附件中下载对应平台的安装包以及应用。' | ||||||
|     permissions: |           releaseDraft: true | ||||||
|       contents: write |           prerelease: false | ||||||
|     runs-on: ubuntu-20.04 |  | ||||||
|     needs: [create-release, build-tauri] |  | ||||||
|  |  | ||||||
|     steps: |  | ||||||
|       - name: publish release |  | ||||||
|         id: publish-release |  | ||||||
|         uses: actions/github-script@v6 |  | ||||||
|         env: |  | ||||||
|           release_id: ${{ needs.create-release.outputs.release_id }} |  | ||||||
|         with: |  | ||||||
|           script: | |  | ||||||
|             github.rest.repos.updateRelease({ |  | ||||||
|               owner: context.repo.owner, |  | ||||||
|               repo: context.repo.repo, |  | ||||||
|               release_id: process.env.release_id, |  | ||||||
|               draft: true, |  | ||||||
|               prerelease: true |  | ||||||
|             }) |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user