* build: 🏗️ 构建与校验

* build: 🏗️ release.yml github action
This commit is contained in:
LOG1997
2025-12-31 09:56:32 +08:00
committed by GitHub
parent 52e2d138e2
commit 2783fb4c0e
2 changed files with 19 additions and 60 deletions

View File

@@ -52,25 +52,13 @@ jobs:
name: web-build name: web-build
path: dist.zip path: dist.zip
- name: Prepare GitHub Pages artifact - name: Deploy to gh-pages branch
run: | uses: peaceiris/actions-gh-pages@v3
cp -r dist-prod dist-gh-pages
- name: Upload GitHub Pages artifact
uses: actions/upload-artifact@v4
with: with:
name: github-pages github_token: ${{ secrets.GITHUB_TOKEN }}
path: dist-gh-pages publish_dir: ./dist-prod
publish_branch: gh-pages
- name: Prepare GitHub Pages artifact force_orphan: true
run: |
cp -r dist-prod dist-gh-pages
- name: Upload GitHub Pages artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: dist-gh-pages
publish-tauri: publish-tauri:
permissions: permissions:
@@ -118,37 +106,8 @@ jobs:
prerelease: false prerelease: false
run: pnpm tauri build run: pnpm tauri build
deploy-gh-pages:
needs: build-web
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download GitHub Pages artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: dist-gh-pages
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload to GitHub Pages
uses: actions/deploy-pages@v2
id: deployment
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist-gh-pages
release: release:
needs: [build-web, publish-tauri, deploy-gh-pages] needs: [build-web, publish-tauri]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code

View File

@@ -37,9 +37,9 @@ try {
console.error('无法获取当前分支名称'); console.error('无法获取当前分支名称');
process.exit(1); process.exit(1);
} }
console.log(`当前分支为: ${currentBranch}`);
// 检查当前分支是否为 release 分支 // 检查当前分支是否为 release 分支
if (currentBranch.startsWith('release/')) { if (currentBranch.startsWith('release')) {
// 如果当前在 release 分支上,检查当前分支的 HEAD 提交是否与 tag 指向的提交一致 // 如果当前在 release 分支上,检查当前分支的 HEAD 提交是否与 tag 指向的提交一致
const currentBranchCommit = execSync(`git rev-parse ${currentBranch}`, { encoding: 'utf-8' }).trim(); const currentBranchCommit = execSync(`git rev-parse ${currentBranch}`, { encoding: 'utf-8' }).trim();