CICD / Docker image (#13) #8
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: Vision CI/CD Main Branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
pre-build: | |
uses: ./.github/workflows/CI-pre-build.yml | |
build-and-test: | |
needs: pre-build | |
uses: ./.github/workflows/CI-build-test.yml | |
build-and-push-main-docker-image: | |
name: Build/Push Main Docker Image | |
needs: pre-build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build/Push Main inatvisionapi | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/inatvisionapi:${{ github.sha }} | |
${{ secrets.DOCKERHUB_USERNAME }}/inatvisionapi:latest | |
- name: Build/Push Main inatvisionapi-cleanup | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile-cleanup | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/inatvisionapi-cleanup:${{ github.sha }} | |
${{ secrets.DOCKERHUB_USERNAME }}/inatvisionapi-cleanup:latest | |
notify-slack: | |
name: Notify Slack | |
needs: build-and-push-main-docker-image | |
if: ${{ success() || failure() }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: iRoachie/[email protected] | |
if: env.SLACK_WEBHOOK_URL != null | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |