db-rest/.github/workflows/docker-image.yml

60 lines
1.8 KiB
YAML
Raw Normal View History

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
2022-04-03 13:44:22 +02:00
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup Node
uses: actions/setup-node@v1
with:
2022-12-19 13:20:17 +01:00
node-version: 18.x
2022-04-03 13:44:22 +02:00
- run: npm install
2022-04-03 14:15:36 +02:00
- run: npm run lint
2023-03-25 16:58:34 +01:00
- run: npm run build
2022-04-03 13:44:22 +02:00
- run: npm test
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
uses: actions/checkout@v2
- name: log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: build Docker image & push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
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
# 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
2022-12-19 13:18:25 +01:00
tags: ghcr.io/${{github.repository}}:v6_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}}