diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9a7a5e7d..d73bade0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - '1.*' tags: - '*' @@ -27,9 +28,9 @@ jobs: - name: "Build gateway" run: make install test - - name: "Resolve docker image tag" + - name: Getting image tag id: version - run: echo ::set-output name=VERSION::$(./mvnw -f gateway/ help:evaluate -q -DforceStdout -Dexpression=imageTag) + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - name: "Build docker image" if: github.repository == 'georchestra/georchestra-gateway' @@ -46,6 +47,11 @@ jobs: if: github.ref == 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' run: docker push georchestra/gateway:latest + - name: "Pushing release branch to docker.io" + if: contains(github.ref, 'refs/heads/1.') && github.repository == 'georchestra/georchestra-gateway' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' + run: | + docker push georchestra/gateway:${{ steps.version.outputs.VERSION }} + - name: "Push tagged image to docker.io" if: github.ref_type == 'tag' && github.ref != 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' run: docker push georchestra/gateway:${{ steps.version.outputs.VERSION }} @@ -60,11 +66,19 @@ jobs: readme-filepath: ./DOCKER_HUB.md short-description: 'Gateway module for the geOrchestra SDI' - - name: "Push image attached to commit id to docker.io" + - name: Login to GitHub Container Registry + if: github.ref == 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "Push image attached to commit id to ghcr.io" if: github.ref == 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' run: | - docker tag georchestra/gateway:latest georchestra/gateway:commit-${{ github.sha }} - docker push georchestra/gateway:commit-${{ github.sha }} + docker tag georchestra/gateway:latest ghcr.io/georchestra/georchestra-gateway/gateway:commit-${{ github.sha }} + docker push ghcr.io/georchestra/georchestra-gateway/gateway:commit-${{ github.sha }} - name: "Remove SNAPSHOT jars from repository" run: | diff --git a/DOCKER_HUB.md b/DOCKER_HUB.md index 3002fb74..3ae73592 100644 --- a/DOCKER_HUB.md +++ b/DOCKER_HUB.md @@ -8,7 +8,7 @@ # Featured tags -- `latest`, `1.0.0` +- `latest`, `1.0.x`, `1.0.0` # Quick reference