From 4f8a547d473cc93ee8ac6d965c89c6cb68329d95 Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Sun, 31 Oct 2021 14:23:49 +0100 Subject: [PATCH] Update CI Signed-off-by: Khanh Ngo --- .github/workflows/build-and-publish.yml | 52 +++++++++++++++++++++++++ .gitlab-ci.yml | 4 -- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-and-publish.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..c30415d --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,52 @@ +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: | + 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: + context: . + push: true + tags: ngoduykhanh/powerdns-admin:latest + + - name: Build release image + uses: docker/build-push-action@v2 + if: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' }} + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d32707a..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,4 +0,0 @@ -include: - - project: 'powerdns-admin/ci' - ref: main - file: '.build-docker-images.yml'