-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (31 loc) · 978 Bytes
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Build Docker image and publish to GHCR
on:
push:
branches:
main
tags:
v*
env:
REGISTRY: ghcr.io
IMAGE_NAME: hbtgmbh/air-pollution-service
BUILD_ID: ${{github.run_number}}
jobs:
test:
name: Test and lint
uses: HBTGmbH/air-pollution-service/.github/workflows/test.yml@main
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_ID }} -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
- name: Push Docker image to Docker Hub
run: docker push -a ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}