-
Notifications
You must be signed in to change notification settings - Fork 25
38 lines (36 loc) · 1.15 KB
/
publish-docker-image.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
name: publish-docker
on:
release:
types: [created]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker buildx build . --tag "epicwink/proxpi:${{ github.ref_name }}"
- name: Run unit-tests in image
run: docker run
--rm
--volume "$(pwd)/tests:/srv/tests"
--entrypoint ''
"epicwink/proxpi:${{ github.ref_name }}"
sh -c 'pip install --requirement /srv/tests/requirements.txt
&& pytest -vvra /srv/tests'
- name: Login to DockerHub
run: >
echo ${{ secrets.DOCKERHUB_PASSWORD }}
| docker login --password-stdin -u epicwink
- name: Publish image
run: docker push "epicwink/proxpi:${{ github.ref_name }}"
- name: Check tag
id: check-tag
run: |
if [[ "${{ github.ref_name }}" =~ ^v\d+\.\d+\.\d+$ ]]; then
echo ::set-output name=match::true
fi
- name: Publish latest image
if: steps.check-tag.outputs.match == 'true'
run: |
docker tag "epicwink/proxpi:${{ github.ref_name }}" epicwink/proxpi:latest
docker push epicwink/proxpi:latest