Skip to content

Reworked entrypoint script #8

Reworked entrypoint script

Reworked entrypoint script #8

Workflow file for this run

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- name: Get current full version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get current sub-version
run: echo "RELEASE_VERSION_2=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
- name: Get current main-version
run: echo "RELEASE_VERSION_1=${RELEASE_VERSION_2%.*}" >> $GITHUB_ENV
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag dodancs/pdns:${RELEASE_VERSION#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} dodancs/pdns:${RELEASE_VERSION_2#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} dodancs/pdns:${RELEASE_VERSION_1#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} dodancs/pdns:latest
docker tag dodancs/pdns:${RELEASE_VERSION#v} ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION_2#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION_1#v}
docker tag dodancs/pdns:${RELEASE_VERSION#v} ghcr.io/dodancs/docker-pdns:latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push the Docker images
run: |
docker push dodancs/pdns:${RELEASE_VERSION#v}
docker push dodancs/pdns:${RELEASE_VERSION_2#v}
docker push dodancs/pdns:${RELEASE_VERSION_1#v}
docker push dodancs/pdns:latest
docker push ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION#v}
docker push ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION_2#v}
docker push ghcr.io/dodancs/docker-pdns:${RELEASE_VERSION_1#v}
docker push ghcr.io/dodancs/docker-pdns:latest