-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (48 loc) · 1.48 KB
/
build.yaml
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
name: docker_build_server
on:
workflow_dispatch:
push:
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# tests
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install test dependencies
shell: bash
run: pip install -r src/server/requirements.txt && pip install -r src/server/test-requirements.txt
id: install_deps
- name: Run tests
shell: bash
run: nosetests src/server
id: run_tests
# docker image build
- name: Extract branch or tag name
shell: bash
run: echo "##[set-output name=ref;]$(RAW_REF=${GITHUB_REF#refs/*/};echo ${RAW_REF//\//_})"
id: extract_ref
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: src/server/
push: true
tags: |
cityofcapetown/cape-of-good-place-names:${{ steps.extract_ref.outputs.ref }}
- name: Build and push latest
if: ${{ steps.extract_ref.outputs.ref == 'master' }}
uses: docker/build-push-action@v2
with:
context: src/server/
push: true
tags: |
cityofcapetown/cape-of-good-place-names:latest