-
Notifications
You must be signed in to change notification settings - Fork 846
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1695 from mscherer/add_ci
Add a workflow for CI
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
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 }} |