-
-
Notifications
You must be signed in to change notification settings - Fork 425
65 lines (54 loc) · 1.58 KB
/
docker.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
name: "Docker"
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set TERM environment variable
run: echo "TERM=xterm" >> $GITHUB_ENV
- name: Extract branch or tag name
run: |
if [[ -n "${GITHUB_HEAD_REF}" ]]; then
# This is a PR, use the source branch name
echo "REF_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
# This is a push, use the branch or tag name from GITHUB_REF
echo "REF_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
fi
- name: Set TAG
run: |
if [[ "${{ env.REF_NAME }}" == "master" ]]; then
echo "TAG=latest" >> $GITHUB_ENV
else
echo "TAG=${{ env.REF_NAME }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: make bootstrap-dev
- name: Run Docker lint
run: make docker-lint
- name: Run Docker build
run: make docker-build
env:
TAG: ${{ env.TAG }}
- name: Run Docker push
if: ${{ env.DOCKER_REGISTRY_USER != '' && env.DOCKER_REGISTRY_PASSWORD != '' }}
run: make docker-push
env:
TAG: ${{ env.TAG }}
DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}