build(deps-dev): bump flatted from 3.3.3 to 3.4.2 in /web/console in the npm_and_yarn group across 1 directory #89
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| # ── Unified Build & Test (Containerized) ────────────────────────── | |
| build: | |
| name: Build & Test (Docker) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and Test inside Container | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.build | |
| load: true | |
| tags: vc-stack-builder:latest | |
| push: false | |
| # GHA Caching for maximum speed | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Do NOT use mirror in GHA (海外环境直连更稳定) | |
| build-args: | | |
| USE_MIRROR=false | |
| - name: Extract Binaries from Image | |
| run: | | |
| # Create a temporary container to extract the artifacts | |
| docker create --name build-temp vc-stack-builder:latest | |
| mkdir -p bin | |
| docker cp build-temp:/app/bin/. ./bin/ | |
| docker rm build-temp | |
| - name: Package binaries | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| mkdir -p release | |
| tar -czf release/vc-stack-${VERSION}-linux-amd64.tar.gz bin/* | |
| cd bin && sha256sum * > ../release/SHA256SUMS && cd .. | |
| - name: Upload artifacts | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vc-stack-binaries | |
| path: release/* | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ── Docker Images Deployment (GHCR) ────────────────────────────── | |
| deploy-docker: | |
| name: Push Production Images | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| target: [vc-management, vc-compute] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/${{ matrix.target }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=sha | |
| - name: Build and push production image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| target: ${{ matrix.target }} | |
| push: true | |
| cache-from: type=gha | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |