From 5f211b599ed717c164c404a8c4dc74a16dcd5a36 Mon Sep 17 00:00:00 2001 From: evangelos-ch Date: Mon, 3 Jul 2023 17:25:23 +0100 Subject: [PATCH] Frist draft of CD pipeline --- .github/workflows/cd.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..28db61e --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,27 @@ +name: Build and publish Docker images + +on: + push: + paths: + - "*/**" + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and publish Docker images + run: | + for dir in */; do + if [ -n "$(git diff --name-only HEAD^ HEAD -- "$dir")" ]; then + docker build -t ghcr.io/${{ github.repository_owner }}/${dir%/}:${{ github.sha }} $dir + docker push ghcr.io/${{ github.repository_owner }}/${dir%/}:${{ github.sha }} + fi + done