docs-site · website-v4 · gcr #71
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 & Publish — Docs Site | |
| run-name: >- | |
| docs-site | |
| · ${{ inputs.tag || github.sha }} | |
| · ${{ inputs.gcr && 'gcr' || '' }}${{ inputs.private-ecr && ' ecr-private' || '' }}${{ inputs.public-ecr && ' ecr-public' || '' }} | |
| # Builds the AIOStack documentation site (newdocs/) as a multi-arch container | |
| # image and pushes it to one or more registries. | |
| # | |
| # - Source: newdocs/ (Nuxt 4) | |
| # - Image: aiostack-docs | |
| # - Platforms: linux/amd64, linux/arm64 | |
| # - Registries: Google Artifact Registry, AWS ECR (private), AWS ECR (public) | |
| # - Caching: GitHub Actions cache (type=gha, mode=max) | |
| # | |
| # Trigger: Manual via workflow_dispatch | |
| # Consumers: aiostack-docs Helm chart deploys the resulting image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| type: string | |
| description: "Image tag (default: 9-char git SHA)" | |
| required: false | |
| public-ecr: | |
| type: boolean | |
| description: "Push to AWS ECR (public) — public.ecr.aws/l5a6x1y4" | |
| default: false | |
| private-ecr: | |
| type: boolean | |
| description: "Push to AWS ECR (private) — 119191042565.dkr.ecr.ap-south-1.amazonaws.com" | |
| default: false | |
| gcr: | |
| type: boolean | |
| description: "Push to Google Artifact Registry — asia-south1-docker.pkg.dev/aurva-gcp" | |
| default: true | |
| # Cancel any in-flight run on the same branch to avoid duplicate publishes. | |
| concurrency: | |
| group: bake-docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write # required by google-github-actions/auth | |
| jobs: | |
| bake: | |
| name: Bake & push multi-arch image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout source | |
| uses: actions/checkout@v4 | |
| - name: 🏷️ Resolve image tag | |
| id: tag | |
| run: | | |
| if [[ -n "${{ inputs.tag }}" ]]; then | |
| VERSION="${{ inputs.tag }}" | |
| echo "source=manual" >> "$GITHUB_OUTPUT" | |
| else | |
| VERSION=$(echo "${{ github.sha }}" | cut -c1-9) | |
| echo "source=git-sha" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "::notice title=Image Tag::aiostack-docs:${VERSION}" | |
| - name: 🎯 Resolve target registries | |
| id: registries | |
| run: | | |
| REGISTRIES="" | |
| TARGETS="" | |
| if ${{ fromJSON(inputs.public-ecr) }} ; then | |
| REGISTRIES="public.ecr.aws/l5a6x1y4" | |
| TARGETS="ecr-public" | |
| fi | |
| if ${{ fromJSON(inputs.private-ecr) }} ; then | |
| if [ -n "${REGISTRIES}" ]; then | |
| REGISTRIES="${REGISTRIES},119191042565.dkr.ecr.ap-south-1.amazonaws.com" | |
| TARGETS="${TARGETS}, ecr-private" | |
| else | |
| REGISTRIES="119191042565.dkr.ecr.ap-south-1.amazonaws.com" | |
| TARGETS="ecr-private" | |
| fi | |
| fi | |
| if ${{ fromJSON(inputs.gcr) }} ; then | |
| if [ -n "${REGISTRIES}" ]; then | |
| REGISTRIES="${REGISTRIES},asia-south1-docker.pkg.dev/aurva-gcp" | |
| TARGETS="${TARGETS}, gcr" | |
| else | |
| REGISTRIES="asia-south1-docker.pkg.dev/aurva-gcp" | |
| TARGETS="gcr" | |
| fi | |
| fi | |
| if [ -z "${REGISTRIES}" ]; then | |
| echo "::error title=No Registry Selected::Pick at least one registry (gcr / private-ecr / public-ecr) when dispatching." | |
| exit 1 | |
| fi | |
| echo "REGISTRIES=$REGISTRIES" >> "$GITHUB_ENV" | |
| echo "targets=$TARGETS" >> "$GITHUB_OUTPUT" | |
| echo "::notice title=Target Registries::${TARGETS}" | |
| - name: 🧰 Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: 🧰 Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: 🔐 Log in — AWS ECR (private) | |
| if: ${{ fromJSON(inputs.private-ecr) || fromJSON(inputs.gcr) }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: 119191042565.dkr.ecr.ap-south-1.amazonaws.com | |
| username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - name: 🔐 Log in — AWS ECR (public) | |
| if: ${{ fromJSON(inputs.public-ecr) }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: public.ecr.aws | |
| username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| env: | |
| AWS_REGION: ap-south-1 | |
| - name: 🔐 Authenticate — Google Cloud | |
| if: ${{ fromJSON(inputs.gcr) }} | |
| id: gcp-auth | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: "${{ secrets.GCP_CREDENTIALS_JSON }}" | |
| - name: 🔐 Configure docker for GAR | |
| if: ${{ fromJSON(inputs.gcr) }} | |
| run: gcloud auth configure-docker asia-south1-docker.pkg.dev | |
| - name: 🚀 Build & push (multi-arch) | |
| uses: docker/bake-action@v5 | |
| with: | |
| workdir: ./newdocs | |
| files: ./docker-bake.hcl | |
| push: true | |
| set: | | |
| *.cache-from=type=gha | |
| *.cache-to=type=gha,mode=max | |
| - name: 📋 Job summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## 🎯 AIOStack Docs Site — Build Summary" | |
| echo "" | |
| echo "| Field | Value |" | |
| echo "|---|---|" | |
| echo "| Image | \`aiostack-docs\` |" | |
| echo "| Tag | \`${VERSION}\` (${{ steps.tag.outputs.source }}) |" | |
| echo "| Platforms | \`linux/amd64\`, \`linux/arm64\` |" | |
| echo "| Registries | ${{ steps.registries.outputs.targets }} |" | |
| echo "| Source | \`newdocs/\` (Nuxt 4) |" | |
| echo "| Commit | [\`${GITHUB_SHA:0:9}\`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) |" | |
| echo "| Ref | \`${{ github.ref_name }}\` |" | |
| echo "| Triggered by | @${{ github.actor }} |" | |
| echo "" | |
| echo "### Pull" | |
| echo "\`\`\`bash" | |
| if ${{ fromJSON(inputs.gcr) }} ; then | |
| echo "docker pull asia-south1-docker.pkg.dev/aurva-gcp/aiostack-docs/aiostack-docs:${VERSION}" | |
| fi | |
| if ${{ fromJSON(inputs.private-ecr) }} ; then | |
| echo "docker pull 119191042565.dkr.ecr.ap-south-1.amazonaws.com/aiostack-docs:${VERSION}" | |
| fi | |
| if ${{ fromJSON(inputs.public-ecr) }} ; then | |
| echo "docker pull public.ecr.aws/l5a6x1y4/aiostack-docs:${VERSION}" | |
| fi | |
| echo "\`\`\`" | |
| } >> "$GITHUB_STEP_SUMMARY" |