Docker Image CI pdns-mysql alpine #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image CI pdns-mysql alpine | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to build, matching pdns-alpine-*. Leave empty to use the latest matching tag." | |
| required: false | |
| type: string | |
| push: | |
| tags: | |
| - 'pdns-alpine-*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Preserve end-to-end runner | |
| run: install -m 0755 tests/e2e.sh "$RUNNER_TEMP/e2e.sh" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Set output | |
| id: vars | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| REF_NAME: ${{ github.ref_name }} | |
| SELECTED_TAG: ${{ inputs.tag }} | |
| TAG_FILTER: pdns-alpine-* | |
| run: | | |
| set -euo pipefail | |
| tag="$SELECTED_TAG" | |
| if [ -z "$tag" ]; then | |
| if [ "$EVENT_NAME" = "push" ]; then | |
| tag="$REF_NAME" | |
| else | |
| tag="$(git tag --list "$TAG_FILTER" --sort=-v:refname | head -n 1)" | |
| fi | |
| fi | |
| if [ -z "$tag" ]; then | |
| echo "No tag found matching $TAG_FILTER" | |
| exit 1 | |
| fi | |
| case "$tag" in | |
| pdns-alpine-*) ;; | |
| *) | |
| echo "Tag '$tag' does not match $TAG_FILTER" | |
| exit 1 | |
| ;; | |
| esac | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "version=${tag##*-}" >> "$GITHUB_OUTPUT" | |
| - name: Check out selected tag | |
| env: | |
| TAG: ${{ steps.vars.outputs.tag }} | |
| run: git checkout --detach "refs/tags/$TAG" | |
| - name: Run image end-to-end test | |
| run: '"$RUNNER_TEMP/e2e.sh" mysql-alpine' | |
| - name: Build and push PDNS mysql | |
| id: docker_build_pdns | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./pdns-mysql | |
| file: ./pdns-mysql/Dockerfile.alpine | |
| platforms: linux/amd64,linux/arm64 | |
| builder: ${{ steps.buildx.outputs.name }} | |
| push: true | |
| tags: ${{ secrets.DOCKER_HUB_USERNAME }}/pdns-mysql:${{ steps.vars.outputs.version }}-alpine | |
| - name: Image digest | |
| run: echo ${{ steps.docker_build_pdns.outputs.digest }} |