--- name: 'Docker Image' on: workflow_dispatch: push: branches: - 'dev' - 'master' tags: - 'v*.*.*' paths-ignore: - .github/** - deploy/** - docker-test/** - docs/** - .dockerignore - .gitattributes - .gitignore - .lgtm.yml - .whitesource - .yarnrc - docker-compose.yml - docker-compose-test.yml - LICENSE - README.md - SECURITY.md jobs: build-and-push-docker-image: name: Build Docker Image runs-on: ubuntu-latest steps: - name: Repository Checkout uses: actions/checkout@v2 - name: Docker Image Metadata id: meta uses: docker/metadata-action@v3 with: images: | powerdnsadmin/pda-legacy tags: | type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Docker Buildx Setup id: buildx uses: docker/setup-buildx-action@v1 - name: Docker Hub Authentication uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME_V2 }} password: ${{ secrets.DOCKERHUB_TOKEN_V2 }} - name: Docker Image Build uses: docker/build-push-action@v2 with: context: ./ file: ./docker/Dockerfile push: true tags: powerdnsadmin/pda-legacy:${{ github.ref_name }} - name: Docker Image Release Tagging uses: docker/build-push-action@v2 if: ${{ startsWith(github.ref, 'refs/tags/v') }} with: context: ./ file: ./docker/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}