-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (36 loc) · 1.42 KB
/
push-dbdump-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Push dbdump image
on:
push:
paths:
- 'images/dbdump/**'
jobs:
docker-image:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Get version from Makefile
id: get-version
run: |
cd images/dbdump
VERSION=$(make echo-version)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Check if image exists
id: check-image
run: |
IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ github.repository }}/dbdump:${{ steps.get-version.outputs.VERSION }} > /dev/null && echo "true" || echo "false")
echo "IMAGE_EXISTS=$IMAGE_EXISTS" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
if: steps.check-image.outputs.IMAGE_EXISTS == 'false'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: steps.check-image.outputs.IMAGE_EXISTS == 'false'
run: |
cd images/dbdump
make docker_build
docker tag serlo/athene2-dbdump-cronjob:${{ steps.get-version.outputs.VERSION }} ghcr.io/${{ github.repository }}/dbdump:${{ steps.get-version.outputs.VERSION }}
docker push ghcr.io/${{ github.repository }}/dbdump:${{ steps.get-version.outputs.VERSION }}