Skip to content

Update pre-commit hooks (#4219) #169

Update pre-commit hooks (#4219)

Update pre-commit hooks (#4219) #169

name: nf-core Docker push
# This builds the docker image and pushes it to DockerHub
# Runs on releases and pushes to 'dev' branch (PR merges)
on:
push:
branches: [dev]
release:
types: [published]
workflow_dispatch:
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
push_dockerhub:
name: Push new Docker image to Docker Hub
runs-on: ubuntu-latest
if: ${{ github.repository == 'nf-core/tools' }}
env:
TARGET_PLATFORM: "linux/amd64,linux/arm64"
steps:
# Free up disk space on GitHub Actions runner (only for dev builds)
- name: Free Disk Space (Ubuntu)
if: github.event_name == 'push'
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up QEMU for multi-architecture build
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
- name: Log in to Docker Hub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
# Determine Docker tags based on trigger
- name: Set Docker tags
id: tags
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "TOOLS_TAGS=-t nfcore/tools:${{ github.event.release.tag_name }} -t nfcore/tools:latest" >> $GITHUB_OUTPUT
echo "DEVCONTAINER_TAGS=${{ github.event.release.tag_name }},latest" >> $GITHUB_OUTPUT
else
echo "TOOLS_TAGS=-t nfcore/tools:dev" >> $GITHUB_OUTPUT
echo "DEVCONTAINER_TAGS=dev" >> $GITHUB_OUTPUT
fi
# Retry building tools image (for 403 errors with nf-test)
- name: Build and push nfcore/tools image
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4
with:
timeout_minutes: 20
max_attempts: 2
retry_wait_seconds: 60
command: |
docker buildx build \
--platform ${{ env.TARGET_PLATFORM }} \
${{ steps.tags.outputs.TOOLS_TAGS }} \
--push --no-cache .
- name: Build and push nfcore/devcontainer image
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3
with:
configFile: .devcontainer/build-devcontainer/devcontainer.json
imageName: nfcore/devcontainer
imageTag: ${{ steps.tags.outputs.DEVCONTAINER_TAGS }}
platform: ${{ env.TARGET_PLATFORM }}
push: always
noCache: true