-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (24 loc) · 926 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
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ghcr.io/prodyna/deployment-overview:latest
# if tag, get the tag as variable
- name: Set env
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# if tagged, create docker tag
- name: Create a tag for the Docker image
if: github.ref == 'refs/heads/main'
run: docker tag ghcr.io/prodyna/deployment-overview:latest ghcr.io/prodyna/deployment-overview:${{ env.tag }}
# if tagged, push the image to the GitHub Container Registry
- name: Push the Docker image to the GitHub Container Registry
if: github.ref == 'refs/heads/main'
run: docker push ghcr.io/prodyna/deployment-overview:${{ env.tag }}