From f1943d23fb322966b88a9fe77ee69e2429d9f8a1 Mon Sep 17 00:00:00 2001 From: Dedy Martadinata S Date: Thu, 30 Jun 2022 16:02:54 +0700 Subject: [PATCH] Update docker-build.yml --- .github/workflows/docker-build.yml | 48 ++++++++++++++++++------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4f58f60..c7dca5a 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -260,36 +260,46 @@ jobs: uses: docker/setup-qemu-action@v1 - uses: docker/setup-buildx-action@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + nitnelave/lldap + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: parse tag uses: gacts/github-slug@v1 id: slug - - uses: docker/metadata-action@v3 - id: meta - with: - images: nitnelave/lldap - tags: nitnelave/lldap:latest, nitnelave/lldap:stable nitnelave/lldap:v${{ steps.slug.outputs.version-semantic }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}.${{ steps.slug.outputs.version-patch }} - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Login to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - uses: docker/build-push-action@v3 - with: - push: ${{ github.event_name != 'pull_request' }} - context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7 - file: ./.github/workflows/Dockerfile.ci - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-to: type=gha,mode=max - cache-from: type=gha + - name: Build and push + if: github.event_name == 'release' + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64,linux/arm/v7 + # Tag as latest, stable, semver, major, major.minor and major.minor.patch. + tags: nitnelave/lldap:latest, nitnelave/lldap:stable, nitnelave/lldap:v${{ steps.slug.outputs.version-semantic }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}.${{ steps.slug.outputs.version-patch }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Update repo description if: github.event_name != 'pull_request' uses: peter-evans/dockerhub-description@v3