Merge pull request #306 from jdev-org/issue-283 #12
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
on: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
build_images: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "Set up Python" | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.9' | |
- name: "python backend - install requirements" | |
working-directory: srv/python | |
run: | | |
pip install -r requirements.txt -r dev-requirements.txt | |
pip install -e . | |
- name: "python backend - Checking format" | |
working-directory: srv/python | |
run: | | |
black . --check | |
- name: "Calculating image tag" | |
if: github.repository == 'mviewer/mviewerstudio' | |
id: version | |
run: | | |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then | |
echo ::set-output name=VERSION::stable | |
elif [[ $GITHUB_REF == 'refs/heads/develop' ]]; then | |
echo ::set-output name=VERSION::latest | |
else | |
echo "This action only works with master or develop branch" | |
exit 1 | |
fi | |
- name: "build the docker containers" | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
docker-compose build | |
- name: "Log in to docker hub" | |
uses: azure/docker-login@v1 | |
if: github.repository == 'mviewer/mviewerstudio' | |
with: | |
username: '${{ secrets.DOCKER_HUB_USERNAME }}' | |
password: '${{ secrets.DOCKER_HUB_PASSWORD }}' | |
- name: "Retag / push the docker images (not stable)" | |
if: github.repository == 'mviewer/mviewerstudio' | |
run: | | |
docker tag mviewer/mviewerstudio:latest mviewer/mviewerstudio:${{ steps.version.outputs.VERSION }} | |
docker push mviewer/mviewerstudio:${{ steps.version.outputs.VERSION }} | |