new variable implementation #44
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, test and push Docker image | |
on: | |
push: | |
branches: | |
- main | |
- TECH-1350-fix-the-following-repos | |
env: | |
SUBMODULE_PATH: lib/pymaker | |
SUBMODULE_BRANCH: codecov-upgrade | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Switch submodule branch | |
run: | | |
git submodule update --init --recursive | |
pushd $SUBMODULE_PATH | |
git checkout $SUBMODULE_BRANCH | |
popd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.6.7' | |
- name: check requirements | |
run: | | |
cat $(find lib -name requirements.txt) | |
echo "" | |
cat $(find lib -name requirements-dev.txt) | |
- name: Run tests | |
run: | | |
python -m pip install --upgrade pip | |
pip install virtualenv --upgrade | |
pip install $(cat requirements.txt $(find lib -name requirements.txt | sort) | sort | uniq | sed 's/ *== */==/g') | |
pip install $(cat requirements-dev.txt $(find lib -name requirements-dev.txt | sort) | sort | uniq | sed 's/ *== */==/g') | |
./test.sh | |
- 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 |