diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 39aa8b8..16ab16f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -17,6 +17,7 @@ jobs: - run: npm install - run: npm run lint - run: npm test + build-and-publish: name: build & publish Docker image needs: [lint-test] @@ -36,3 +37,22 @@ jobs: tags: | derhuerst/db-rest:5 derhuerst/db-rest:latest + + # this is for the public-transport/infrastructure cluster + - name: log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: determine commit hash + id: hash + run: echo "::set-output name=hash::$(echo $GITHUB_SHA | head -c7)" + - name: determine current date and time + id: datetime + run: echo "::set-output name=datetime::$(date -u +'%Y-%m-%dT%H.%M.%SZ')" + - name: push Docker image to GitHub Registry + uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/${{github.repository}}:v5_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}}