From 4e4d60d08e7c3d5620fbcd8f4a16d5e179fcbd19 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Wed, 18 Aug 2021 10:01:16 +0100 Subject: [PATCH 1/3] docker build --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 933fd447..0b44821f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: id: meta uses: docker/metadata-action@v3 with: - images: sbs20/scanservjs + images: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -36,5 +36,5 @@ jobs: with: context: . push: ${{ github.event_name != 'pull_request' }} - tags: release-${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/release-${{ steps.meta.outputs.tags }} + labels: ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.meta.outputs.labels }} From 828c4206b950896808ad49f556c76f7f294114a0 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Wed, 18 Aug 2021 10:48:45 +0100 Subject: [PATCH 2/3] Docker build --- .github/workflows/docker.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0b44821f..7b9f02f0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -30,11 +30,28 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build + - name: Push staging + if: github.ref == 'refs/heads/staging' + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:staging + + - name: Push master + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:latest + + - name: Get version + id: get_version + if: startsWith(github.ref, 'refs/tags/v') + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Push release + if: startsWith(github.ref, 'refs/tags/v') uses: docker/build-push-action@v2 with: - context: . push: ${{ github.event_name != 'pull_request' }} - tags: ${{ secrets.DOCKERHUB_USERNAME }}/release-${{ steps.meta.outputs.tags }} - labels: ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.meta.outputs.labels }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs:release-${{ steps.get_version.outputs.VERSION }} From 0d84c87f481f6e12744b1c6fe3050dac813836fb Mon Sep 17 00:00:00 2001 From: sbs20 Date: Wed, 18 Aug 2021 10:57:34 +0100 Subject: [PATCH 3/3] Docker build --- .github/workflows/docker.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7b9f02f0..2199b52b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,11 +2,12 @@ name: docker-build on: workflow_dispatch: -# push: -# branches: -# - 'master' -# tags: -# - 'v*' + push: + branches: + - 'master' + - 'staging' + tags: + - 'v*' jobs: docker: @@ -15,12 +16,6 @@ jobs: - name: Check out the repo uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ secrets.DOCKERHUB_USERNAME }}/scanservjs - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1