Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: CI-CD
run-name: >-
${{ format('Main deploy: {0}', github.sha) }}
${{ format('Merge PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) }}

on:
push:
pull_request:
types: [closed]
branches: ["main"]

permissions:
Expand All @@ -12,6 +13,7 @@ permissions:
jobs:
quality-gate:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -43,13 +45,15 @@ jobs:
name: Deploy Gate
runs-on: ubuntu-latest
needs: [quality-gate]
if: ${{ github.event.pull_request.merged == true }}
steps:
- run: echo "Ready for build/push on main"
- run: echo "Ready for build/push on merged PR to main"

build-and-push:
name: Build and Push Docker
runs-on: ubuntu-latest
needs: [deploy-gate]
if: ${{ github.event.pull_request.merged == true }}
permissions:
contents: read
packages: write
Expand All @@ -69,7 +73,7 @@ jobs:
- name: Extract version
id: version
run: |
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
SHORT_SHA=$(echo ${{ github.event.pull_request.merge_commit_sha || github.sha }} | cut -c1-7)
VERSION="staging-${SHORT_SHA}"
REGISTRY_IMAGE="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/${{ matrix.service }}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
Expand Down
Loading