nf-core_modules/.github/workflows/docker.yml

48 lines
1.6 KiB
YAML
Raw Normal View History

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
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"
- name: Build images
run: |
echo "Running the docker build"
echo $TOOLS
for d in tools/*; do
echo "In directory $d"
for TOOL in $TOOLS; do
echo "Tool is $TOOL"
if echo $d/ | grep -q "$TOOL"; then
cd "$GITHUB_WORKSPACE/$d"
TOOLNAME=$(basename `pwd`)
IMGNAME=docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${TOOLNAME,,}:$GITHUB_SHA
echo "Image name is: $IMGNAME"
docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com
docker build -t $IMGNAME .
docker push $IMGNAME
fi;
done;
done;