add swagger UI to app #143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
# based on https://stackoverflow.com/a/64373702 | |
build-docker: | |
name: Build docker image & run tests | |
runs-on: ubuntu-latest | |
env: | |
COMPOSE_FILE: docker/docker-compose.yml | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build docker images | |
run: docker-compose build web | |
- name: Run tests | |
run: docker-compose run web python -m pytest | |
push-docker: | |
if: github.event_name == 'push' | |
name: Push docker image | |
runs-on: ubuntu-latest | |
env: | |
COMPOSE_FILE: docker/docker-compose.yml | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build docker images | |
run: docker-compose build web | |
- name: Login to ghcr | |
run: echo ${{ github.token }} | docker login ghcr.io -u hgrf --password-stdin | |
- name: Push to ghcr | |
run: docker push ghcr.io/hgrf/racine:latest | |
- name: Push to ghcr (tagged) | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
sed s'/refs\/tags\///g' <(echo "${{ github.ref }}") | (read TAG; \ | |
docker tag ghcr.io/hgrf/racine:latest \ | |
ghcr.io/hgrf/racine:$TAG && \ | |
docker push ghcr.io/hgrf/racine:$TAG && \ | |
echo Successfully pushed ghcr.io/hgrf/racine:$TAG | |
) | |