refactor(ci): remove dev environment, build images in CD

This commit is contained in:
2026-03-16 06:28:36 +04:00
parent da6bdc3813
commit 64dc3a3813
2 changed files with 67 additions and 120 deletions

View File

@@ -4,11 +4,9 @@ on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
permissions:
contents: read
@@ -119,63 +117,6 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
images-push:
name: Docker / build & push ${{ matrix.service }}
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 20
environment: ${{ github.ref_name == 'main' && 'Production' || 'Development' }}
strategy:
fail-fast: false
matrix:
service:
- bot
- miniapp
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
- name: Configure Artifact Registry auth
run: |
gcloud auth configure-docker "${{ vars.GCP_REGION || 'europe-west1' }}-docker.pkg.dev" --quiet
- name: Resolve image name
id: image
env:
GCP_REGION: ${{ vars.GCP_REGION || 'europe-west1' }}
ARTIFACT_REPOSITORY: ${{ vars.ARTIFACT_REPOSITORY || 'household-bot' }}
run: |
repo="${GCP_REGION}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/${ARTIFACT_REPOSITORY}"
echo "name=${repo}/${{ matrix.service }}:${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
echo "cache_ref=${repo}/${{ matrix.service }}:cache" >> "$GITHUB_OUTPUT"
echo "latest=${repo}/${{ matrix.service }}:latest" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: apps/${{ matrix.service }}/Dockerfile
push: true
tags: |
${{ steps.image.outputs.name }}
${{ steps.image.outputs.latest }}
platforms: linux/amd64
provenance: false
cache-from: type=registry,ref=${{ steps.image.outputs.cache_ref }}
cache-to: type=registry,ref=${{ steps.image.outputs.cache_ref }},mode=max
# Gate job: CD triggers on this workflow's conclusion.
# By depending on all jobs, a failure in any job marks CI as failed,
# which causes CD's `workflow_run` trigger to see conclusion != 'success'
@@ -183,7 +124,7 @@ jobs:
ci:
name: CI complete
runs-on: ubuntu-latest
needs: [quality, terraform, images-pr, images-push]
needs: [quality, terraform, images-pr]
if: always()
steps:
- name: Check all jobs passed
@@ -193,7 +134,7 @@ jobs:
failed=false
for result in $(echo "$results" | jq -r '.[].result'); do
# 'skipped' is expected — images-pr skips on push, images-push skips on PR
# 'skipped' is expected — images-pr skips on push
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
echo "Job failed with result: $result"
failed=true