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
13 changes: 4 additions & 9 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
name: CI-CD
run-name: >-
${{ github.event_name == 'pull_request' && format('Merge PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) || format('Manual run by {0}', github.actor) }}
${{ format('Main deploy: {0}', github.sha) }}

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

permissions:
contents: read

jobs:
quality-gate:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -46,15 +43,13 @@ jobs:
name: Deploy Gate
runs-on: ubuntu-latest
needs: [quality-gate]
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
steps:
- run: echo "Ready for build/push (merge or manual trigger)"
- run: echo "Ready for build/push on main"

build-and-push:
name: Build and Push Docker
runs-on: ubuntu-latest
needs: [deploy-gate]
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
permissions:
contents: read
packages: write
Expand All @@ -74,7 +69,7 @@ jobs:
- name: Extract version
id: version
run: |
SHORT_SHA=$(echo ${{ github.event.pull_request.merge_commit_sha || github.sha }} | cut -c1-7)
SHORT_SHA=$(echo ${{ 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