feat(infrastructure): test basic workflow

This commit is contained in:
2025-09-22 18:52:23 +02:00
parent 5de64c5b1f
commit 37f6fb2882
2 changed files with 48 additions and 0 deletions

46
.github/workflows/workflow.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Build, Push and Update Image in Manifest
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-and-update:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Login to registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
with:
context: ./cd-test
push: true
tags: ghcr.io/${{ secrets.DOCKER_USER }}/cd-test:latest
- name: Get image digest
# docker/build-push-action outputs `digest` automatically
run: echo "IMAGE_DIGEST=${{ steps.build.outputs.digest }}" >> $GITHUB_ENV
- name: Update manifest with new image digest
uses: OpsVerseIO/image-updater-action@0.1.0
with:
valueFile: 'cd-test/guestbook-ui-deployment.yaml'
propertyPath: 'spec.template.spec.containers[0].image'
# zapíšeme image s digestem
value: ${{ secrets.DOCKER_USER }}/cd-test@${{ env.IMAGE_DIGEST }}
commitChange: true
message: "Update image to digest ${{ env.IMAGE_DIGEST }}"