Update Dockerfile #308
Workflow file for this run
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: Tag | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- 'v**' | |
release: | |
types: [prereleased,released] | |
env: | |
IMAGE_PREFIX: ouestfrance/cdp2 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get image tag | |
id: get_image_tag | |
run: | | |
if [[ "${{github.event_name}}" == "release" ]]; then | |
TAG=$IMAGE_PREFIX:${{ github.event.release.tag_name }} | |
if [[ "${{github.event.release.prerelease}}" == "false" ]];then | |
TAG=$TAG,$IMAGE_PREFIX:stable | |
fi | |
fi | |
if [[ "${{github.event_name}}" != "release" ]]; then | |
TAG=$IMAGE_PREFIX:${GITHUB_REF#refs/*/}-${{github.run_number}},$IMAGE_PREFIX:${GITHUB_REF#refs/*/}-latest | |
fi | |
if [[ "${{github.event_name}}" == "push" && "${{github.ref}}" == "refs/heads/master" ]]; then | |
TAG=$TAG,$IMAGE_PREFIX:latest | |
fi | |
echo TAGS=$TAG >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9.20' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools mock | |
python -m pip install -r requirements.txt | |
python3 setup.py install | |
- name: Unit tests | |
run: | | |
python setup.py test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.TAGS }} |