Skip to content

publish-docker

publish-docker #52

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