CI: publish Docker image to GitHub registry as well 💚

This commit is contained in:
Jannis R 2022-06-06 14:24:37 +02:00
parent 25debd10b6
commit 8ad4336689
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -17,6 +17,7 @@ jobs:
- run: npm install - run: npm install
- run: npm run lint - run: npm run lint
- run: npm test - run: npm test
build-and-publish: build-and-publish:
name: build & publish Docker image name: build & publish Docker image
needs: [lint-test] needs: [lint-test]
@ -36,3 +37,22 @@ jobs:
tags: | tags: |
derhuerst/db-rest:5 derhuerst/db-rest:5
derhuerst/db-rest:latest 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}}