Skip to content

Commit

Permalink
Merge pull request #1695 from mscherer/add_ci
Browse files Browse the repository at this point in the history
Add a workflow for CI
  • Loading branch information
sgoggins authored Apr 7, 2022
2 parents 24e55f6 + 5582368 commit d45e2a5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build Docker images
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published

jobs:
build:
name: Build image
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
- name: Run the build
run: |
set -ex
# use that here since the variable are not present before start, so can't be in env
export LOGIN=$GITHUB_REPOSITORY_OWNER
echo $PASSWORD | docker login $REGISTRY -u $LOGIN --password-stdin
for i in util/docker/* ; do
CONTAINER=$(basename $i)
if [[ $CONTAINER != 'frontend' ]]; then
echo "Building $CONTAINER"
export IMAGE=$LOGIN/augur_$CONTAINER
DOCKERFILE=${i}/Dockerfile
TAG=$GITHUB_SHA
docker build . -f $DOCKERFILE --tag $REGISTRY/$IMAGE:$TAG --tag $REGISTRY/$IMAGE:latest
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then
TAG=$(basename $GITHUB_REF)
docker push $REGISTRY/$IMAGE:latest
docker push $REGISTRY/$IMAGE:$TAG
elif [[ $GITHUB_EVENT_NAME == 'push' ]]; then
docker push $REGISTRY/$IMAGE-devel:latest
fi
fi
done
env:
REGISTRY: ghcr.io
PASSWORD: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d45e2a5

Please sign in to comment.