2020-03-06 11:54:09 +00:00
|
|
|
name: Build Docker Images
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Only on pushes to master (after PRs are merged)
|
|
|
|
branches: master
|
|
|
|
# Only if a conda environment file or a docker build file has been updated
|
|
|
|
paths:
|
|
|
|
- tools/*/environment.yml
|
|
|
|
- tools/*/Dockerfile
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Check out the repo
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
|
|
|
# Find the tool wrappers that changed
|
|
|
|
# Annoyingly, matrix can't take dynamic variables
|
|
|
|
- name: Find changed tools
|
2020-03-06 11:56:08 +00:00
|
|
|
run: |
|
|
|
|
TOOLS=$( git diff --name-only HEAD~ | egrep -o 'tools\/[^\/]+\/' | sort | uniq | awk NF )
|
|
|
|
echo "Tools that appear to have been updated:"
|
|
|
|
echo $TOOLS
|
|
|
|
# Save so that GitHub Actions can see this variable in the next step
|
|
|
|
echo "::set-env name=TOOLS::$TOOLS"
|
2020-03-06 11:54:09 +00:00
|
|
|
|
|
|
|
- name: Build images
|
|
|
|
run: |
|
2020-03-06 11:56:08 +00:00
|
|
|
echo "Running the docker build"
|
|
|
|
echo $TOOLS
|
2020-03-06 11:54:09 +00:00
|
|
|
for d in tools/*; do
|
2020-03-06 11:56:08 +00:00
|
|
|
echo "In directory $d"
|
2020-03-06 11:54:09 +00:00
|
|
|
for TOOL in $TOOLS; do
|
2020-03-06 11:56:08 +00:00
|
|
|
echo "Tool is $TOOL"
|
2020-03-06 11:54:09 +00:00
|
|
|
if echo $d/ | grep -q "$TOOL"; then
|
|
|
|
cd "$GITHUB_WORKSPACE/$d"
|
|
|
|
TOOLNAME=$(basename `pwd`)
|
|
|
|
IMGNAME=docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${TOOLNAME,,}:$GITHUB_SHA
|
2020-03-06 11:56:08 +00:00
|
|
|
echo "Image name is: $IMGNAME"
|
2020-03-06 11:54:09 +00:00
|
|
|
docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com
|
|
|
|
docker build -t $IMGNAME .
|
|
|
|
docker push $IMGNAME
|
|
|
|
fi;
|
|
|
|
done;
|
|
|
|
done;
|