🔖 Version 1.0.5 #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "ng-*" | |
| # 并发控制:确保同一标签只有一个 release 任务运行 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| PYTHONUTF8: 1 | |
| AKAGI_MOCK_MODE: 0 | |
| jobs: | |
| pre-release-test: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: akagi_backend/pyproject.toml | |
| - name: Cache Python virtual environment | |
| uses: actions/cache@v5 | |
| id: venv-cache | |
| with: | |
| path: akagi_backend/.venv | |
| key: venv-${{ runner.os }}-py3.12-${{ hashFiles('akagi_backend/pyproject.toml') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-py3.12- | |
| - name: Install dependencies | |
| if: steps.venv-cache.outputs.cache-hit != 'true' | |
| working-directory: akagi_backend | |
| shell: pwsh | |
| run: | | |
| python -m venv .venv | |
| .\.venv\Scripts\Activate.ps1 | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run tests | |
| working-directory: akagi_backend | |
| shell: pwsh | |
| run: | | |
| .\.venv\Scripts\Activate.ps1 | |
| python -m pytest tests/ -k "not e2e" --tb=short -v | |
| release: | |
| needs: pre-release-test | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from tag | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $version = "${{ github.ref_name }}" | |
| echo "VERSION=$version" >> $env:GITHUB_OUTPUT | |
| $clean_version = $version -replace '^ng-?v?', '' | |
| echo "CLEAN_VERSION=$clean_version" >> $env:GITHUB_OUTPUT | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: akagi_backend/pyproject.toml | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: | | |
| akagi_frontend/package-lock.json | |
| electron/package-lock.json | |
| - name: Cache Python virtual environment | |
| uses: actions/cache@v5 | |
| id: venv-cache | |
| with: | |
| path: akagi_backend/.venv | |
| key: venv-${{ runner.os }}-py3.12-${{ hashFiles('akagi_backend/pyproject.toml') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-py3.12- | |
| - name: Install Python dependencies | |
| if: steps.venv-cache.outputs.cache-hit != 'true' | |
| working-directory: akagi_backend | |
| shell: pwsh | |
| run: | | |
| python -m venv .venv | |
| .\.venv\Scripts\Activate.ps1 | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Install Frontend dependencies | |
| working-directory: akagi_frontend | |
| run: npm ci | |
| - name: Install Electron dependencies | |
| working-directory: electron | |
| run: npm ci | |
| - name: Build Electron App | |
| working-directory: electron | |
| run: npm run build | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/release/*.exe | |
| dist/release/*.zip | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} | |
| name: Release ${{ steps.version.outputs.VERSION }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Release 失败时上传构建产物用于调试 | |
| - name: Upload build artifacts on failure | |
| uses: actions/upload-artifact@v6 | |
| if: failure() | |
| with: | |
| name: failed-release-${{ steps.version.outputs.VERSION }} | |
| path: | | |
| dist/ | |
| electron/**/*.log | |
| retention-days: 14 |