Skip to content

Updated Doc

Updated Doc #3

name: CI-CD Pipeline Loan-Default-Prediction
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
REPO_NAME: ${{ secrets.REPO_NAME }}
GIT_REPO_NAME: ${{ secrets.GIT_REPO_NAME }}
GIT_USER: ${{ secrets.GIT_USER }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci_pipeline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Format
run: black .
cd_pipeline:
runs-on: ubuntu-latest
needs: [ci_pipeline]
steps:
- uses: actions/checkout@v2
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y-%m-%d--%H-%M-%S')" >> $GITHUB_ENV
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ghcr.io/$GIT_USER/$GIT_REPO_NAME:${{ env.DATE }} --tag $DOCKER_USER/$REPO_NAME:${{ env.DATE }}
- name: Docker Hub login
run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- name: Push Docker image to Docker Hub
run: docker push $DOCKER_USER/$REPO_NAME:${{ env.DATE }}
- name: GitHub Container Registry login
run: echo $GIT_TOKEN | docker login ghcr.io -u $GIT_USER --password-stdin
- name: Push Docker image to GitHub Container Registry
run: docker push ghcr.io/$GIT_USER/$GIT_REPO_NAME:${{ env.DATE }}