Merge pull request #1982 from cmu-delphi/ds/logger2 #567
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 indicator container images and upload to registry | |
on: | |
push: | |
branches: [main, prod] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
packages: [backfill_corrections] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: cmu-delphi-deploy-machine | |
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }} | |
- name: Build, tag, and push image to Github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
baseRef="${GITHUB_REF#*/}" | |
baseRef="${baseRef#*/}" | |
case "${baseRef}" in | |
main) | |
imageTag="dev" | |
;; | |
prod) | |
imageTag="latest" | |
;; | |
*) | |
imageTag="${baseRef//\//_}" # replace `/` with `_` in branch name | |
;; | |
esac | |
if [ -z ${{ matrix.packages }} ]; then | |
echo "The matrix list is empty so we will not build any images." | |
else | |
cd ${{ github.workspace }}/${{ matrix.packages }} | |
echo "using tag: --${imageTag}--" | |
DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain docker build --secret id=GITHUB_TOKEN -t ghcr.io/${{ github.repository }}-${{ matrix.packages }}:$imageTag --file Dockerfile . | |
docker push ghcr.io/${{ github.repository }}-${{ matrix.packages }}:$imageTag | |
fi |