From 8ad43366898b523c94f7f9606cb0db75b667f640 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Mon, 6 Jun 2022 14:24:37 +0200 Subject: [PATCH] =?UTF-8?q?CI:=20publish=20Docker=20image=20to=20GitHub=20?= =?UTF-8?q?registry=20as=20well=20=F0=9F=92=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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}}