From 1a4e81dae5070461981ecbc7fe248ed968b6e73a Mon Sep 17 00:00:00 2001 From: xgaia Date: Thu, 23 Dec 2021 17:59:30 +0100 Subject: [PATCH 1/3] Use Github action to autobuild docker image --- .github/workflows/docker-publish.yml | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..135cba4 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,55 @@ +name: Docker publish + +on: + push: + branches: + - 'master' + - 'gh-action' + tags: + - '*.*.*' + +jobs: + docker: + environment: docker-registry + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: registry.hub.docker.com/${{ secrets.DOCKER_USERNAME_TOKEN }}/ldap-user-manager + # 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}} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to registry + uses: docker/login-action@v1 + with: + registry: registry.hub.docker.com + username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + secrets: | + GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }} From 377106ad28095a87953fa51b2dceb7e539b7cdb3 Mon Sep 17 00:00:00 2001 From: xgaia Date: Thu, 23 Dec 2021 18:02:38 +0100 Subject: [PATCH 2/3] fix: typo --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 135cba4..c8bcb00 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -22,7 +22,7 @@ jobs: uses: docker/metadata-action@v3 with: # list of Docker images to use as base name for tags - images: registry.hub.docker.com/${{ secrets.DOCKER_USERNAME_TOKEN }}/ldap-user-manager + images: registry.hub.docker.com/${{ secrets.DOCKER_REGISTRY_USERNAME }}/ldap-user-manager # generate Docker tags based on the following events/attributes tags: | type=ref,event=branch From 66eb64a41e7f42bc7a2d95a0394b6e559dbc7a9f Mon Sep 17 00:00:00 2001 From: xgaia Date: Thu, 23 Dec 2021 18:05:08 +0100 Subject: [PATCH 3/3] publish only master branch and tags --- .github/workflows/docker-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c8bcb00..efc672d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -4,9 +4,8 @@ on: push: branches: - 'master' - - 'gh-action' tags: - - '*.*.*' + - v'*.*' jobs: docker: