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

55 lines
1.9 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:
2020-07-11 12:36:12 +00:00
- software/*/environment.yml
- software/*/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: |
2020-03-06 14:03:13 +00:00
TOOLS=$( git diff --name-only HEAD~ | egrep -o 'tools\/[^\/]+\/' | sort | uniq | awk NF | tr '\r\n' ' ' )
# Save so that GitHub Actions can see this variable in the next step
echo "::set-env name=TOOLS::$TOOLS"
2020-03-06 14:03:13 +00:00
echo "Tools that appear to have been updated:"
echo $TOOLS
- name: Build images
run: |
2020-03-06 14:03:13 +00:00
echo "Tools that appear to have been updated:"
echo -e $TOOLS
echo '-----'
for TOOL in $TOOLS; do
echo $TOOL
done;
echo '-----'
2020-07-11 12:36:12 +00:00
for d in software/*; do
for TOOL in $TOOLS; do
2020-03-06 14:03:13 +00:00
echo "$d -- $TOOL"
if echo $d/ | grep -q "$TOOL"; then
cd "$GITHUB_WORKSPACE/$d"
TOOLNAME=$(basename `pwd`)
2020-03-06 14:03:13 +00:00
# IMGNAME=docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${TOOLNAME,,}:$GITHUB_SHA
# TODO: How do we have a proper version tag here?
IMGNAME=docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${TOOLNAME,,}:latest
echo "Image name is: $IMGNAME"
2020-03-06 14:03:13 +00:00
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin docker.pkg.github.com
docker build -t $IMGNAME .
docker push $IMGNAME
fi;
done;
done;