ci: 优化 workflow (check + build + release) #5
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| check-frontend: | |
| name: Check Frontend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Install | |
| working-directory: ChuChartManager/Front | |
| run: pnpm install | |
| - name: Type Check | |
| working-directory: ChuChartManager/Front | |
| run: pnpm vue-tsc --noEmit | |
| - name: Build | |
| working-directory: ChuChartManager/Front | |
| run: pnpm build | |
| check-backend: | |
| name: Check Backend | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| dotnet-quality: "preview" | |
| - name: Build | |
| run: dotnet build ChuChartManager/ChuChartManager.csproj -c Release | |
| build: | |
| name: Build | |
| runs-on: windows-latest | |
| needs: [check-frontend, check-backend] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| dotnet-quality: "preview" | |
| - name: Build Frontend | |
| working-directory: ChuChartManager/Front | |
| run: | | |
| pnpm install | |
| pnpm build | |
| - name: Publish | |
| run: dotnet publish ChuChartManager/ChuChartManager.csproj -c Release -r win-x64 --self-contained -o publish /p:PublishSingleFile=false | |
| - name: Package | |
| shell: pwsh | |
| run: Compress-Archive -Path publish/* -DestinationPath ChuChartManager-win-x64.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ChuChartManager-win-x64 | |
| path: ChuChartManager-win-x64.zip | |
| release: | |
| name: Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ChuChartManager-win-x64 | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ChuChartManager-win-x64.zip | |
| generate_release_notes: true | |
| prerelease: false |