Merge pull request #16 from makerdao/TECH-4674-Fixing-failovers #61
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: Build Docker image | |
on: | |
push: | |
branches: | |
- main | |
env: | |
SUBMODULE_PATH: lib/pymaker | |
SUBMODULE_BRANCH: codecov-upgrade | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Switch submodule branch | |
run: | | |
git submodule update --init --recursive | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install virtualenv --upgrade | |
pip install -r requirements.txt | |
- name: Login to Docker Hub | |
id: docker-login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract commit hash | |
id: vars | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build, tag, and push image to Dockerhub | |
id: build-image | |
env: | |
SHA_TAG: ${{ steps.vars.outputs.sha_short }} | |
LATEST_TAG: latest | |
REGISTRY: makerdao | |
REPO_NAME: maker-keeper | |
run: | | |
echo "$REGISTRY/$REPO_NAME:$LATEST_TAG" | |
echo "$REGISTRY/$REPO_NAME:$SHA_TAG" | |
docker build -t $REGISTRY/$REPO_NAME:$SHA_TAG \ | |
-t $REGISTRY/$REPO_NAME:$LATEST_TAG \ | |
. | |
docker push $REGISTRY/$REPO_NAME --all-tags |