2021-09-13 18:14:49 +02:00
|
|
|
name: build & publish Docker image
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-12-19 13:18:25 +01:00
|
|
|
- 6
|
2021-09-13 18:14:49 +02:00
|
|
|
jobs:
|
2022-04-03 13:44:22 +02:00
|
|
|
lint-test:
|
2023-03-25 16:58:34 +01:00
|
|
|
name: lint, build & test
|
2024-08-08 16:00:29 +02:00
|
|
|
uses: './.github/workflows/lint-test.yml'
|
2022-06-06 14:24:37 +02:00
|
|
|
|
2021-09-13 18:14:49 +02:00
|
|
|
build-and-publish:
|
|
|
|
name: build & publish Docker image
|
2022-04-03 13:44:22 +02:00
|
|
|
needs: [lint-test]
|
2021-09-13 18:14:49 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: check out the repo
|
2024-08-08 16:10:20 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-09-19 11:00:40 +02:00
|
|
|
- name: set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-04-20 00:33:18 +02:00
|
|
|
- name: configure Docker to use buildx
|
2024-08-08 16:02:30 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-09-13 18:14:49 +02:00
|
|
|
- name: log in to Docker Hub
|
2024-08-08 16:09:18 +02:00
|
|
|
uses: docker/login-action@v3
|
2021-09-13 18:14:49 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
|
|
|
- name: build Docker image & push to Docker Hub
|
2023-04-20 00:33:18 +02:00
|
|
|
uses: docker/build-push-action@v4
|
2021-09-13 18:14:49 +02:00
|
|
|
with:
|
2023-03-26 18:33:48 +02:00
|
|
|
context: .
|
2021-09-13 18:14:49 +02:00
|
|
|
push: true
|
2023-09-19 11:00:40 +02:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-09-13 18:14:49 +02:00
|
|
|
tags: |
|
2022-12-19 13:18:25 +01:00
|
|
|
derhuerst/db-rest:6
|
2021-09-13 18:14:49 +02:00
|
|
|
derhuerst/db-rest:latest
|
2023-04-20 00:33:18 +02:00
|
|
|
# https://docs.docker.com/build/ci/github-actions/examples/#github-cache
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd
|
2022-06-06 14:24:37 +02:00
|
|
|
|
|
|
|
# this is for the public-transport/infrastructure cluster
|
|
|
|
- name: log in to GitHub Container Registry
|
2024-08-08 16:09:18 +02:00
|
|
|
uses: docker/login-action@v3
|
2022-06-06 14:24:37 +02:00
|
|
|
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
|
2023-04-20 00:33:18 +02:00
|
|
|
uses: docker/build-push-action@v4
|
2022-06-06 14:24:37 +02:00
|
|
|
with:
|
2023-03-26 18:33:48 +02:00
|
|
|
context: .
|
2022-06-06 14:24:37 +02:00
|
|
|
push: true
|
2023-09-19 11:00:40 +02:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2024-01-25 14:49:39 +01:00
|
|
|
tags: |
|
|
|
|
ghcr.io/${{github.repository}}:v6
|
|
|
|
ghcr.io/${{github.repository}}:v6_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}}
|
2023-04-20 00:33:18 +02:00
|
|
|
# https://docs.docker.com/build/ci/github-actions/examples/#github-cache
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd
|