Fix CI pipeline #97
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 Image CI | |
on: [push] | |
jobs: | |
build-test-release: | |
name: Build, Test and Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Docker image | |
run: ./docker-build.sh "${GITHUB_REF_SLUG}" | |
- name: Run tests | |
run: docker run --rm -e PROCESS_TYPE=test --name django-coleman "mrsarm/django-coleman:${GITHUB_REF_SLUG}" | |
- name: Release Docker image | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: docker push "mrsarm/django-coleman:${GITHUB_REF_SLUG}" | |
- name: Tag "latest" | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: docker tag "mrsarm/django-coleman:${GITHUB_REF_SLUG}" mrsarm/django-coleman:latest | |
- name: Release "latest" | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: docker push mrsarm/django-coleman:latest |