mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 19:18:17 +00:00
54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
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 | tr '\r\n' ' ' )
|
|
# Save so that GitHub Actions can see this variable in the next step
|
|
echo "::set-env name=TOOLS::$TOOLS"
|
|
echo "Tools that appear to have been updated:"
|
|
echo $TOOLS
|
|
|
|
|
|
- name: Build images
|
|
run: |
|
|
echo "Tools that appear to have been updated:"
|
|
echo -e $TOOLS
|
|
echo '-----'
|
|
for TOOL in $TOOLS; do
|
|
echo $TOOL
|
|
done;
|
|
echo '-----'
|
|
for d in tools/*; do
|
|
for TOOL in $TOOLS; do
|
|
echo "$d -- $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
|
|
# TODO: How do we have a proper version tag here?
|
|
IMGNAME=docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${TOOLNAME,,}:latest
|
|
echo "Image name is: $IMGNAME"
|
|
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;
|