2021-10-31 13:23:49 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push-docker-image:
|
|
|
|
name: Build Docker image and push to repositories
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
ngoduykhanh/powerdns-admin
|
|
|
|
tags: |
|
2021-11-06 14:37:13 +00:00
|
|
|
type=ref,event=tag
|
2021-10-31 13:23:49 +00:00
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build latest image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
with:
|
2021-10-31 13:34:35 +00:00
|
|
|
context: ./
|
|
|
|
file: ./docker/Dockerfile
|
2021-10-31 13:23:49 +00:00
|
|
|
push: true
|
|
|
|
tags: ngoduykhanh/powerdns-admin:latest
|
|
|
|
|
|
|
|
- name: Build release image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-10-31 13:34:35 +00:00
|
|
|
context: ./
|
|
|
|
file: ./docker/Dockerfile
|
2021-11-06 14:25:20 +00:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-10-31 13:23:49 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2021-11-06 14:37:13 +00:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|