Skip to content

Update builder.yml #171

Update builder.yml

Update builder.yml #171

Workflow file for this run

name: deploy-docker-singularity
on:
push:
branches:
- 'master'
jobs:
docker:
name: Create Docker image and push to Dockerhub
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to DockerHub
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
tags: adamwilsonlab/emma:latest
env:
ACTIONS_RUNNER_DEBUG: true
# Singularity section - uses the image pushed above
# this is inefficient in that it pulls from dockerhub - maybe switch to use the local docker image?
# singularity:
# if: ${{ FALSE }} # use this to turn on singularity compilation as a release - but has to be <2GB for github.
# name: Create Singularity .sif and save as release
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - name: Singularity - Checkout code
# uses: actions/checkout@v2
# - name: Singularity - Get Latest Tag
# run: |
# # Get the latest tag, we won't build if it's the current
# git fetch --tags
# latest_tag=$(git tag | tail -1)
# echo "latest_tag=$latest_tag" >> $GITHUB_ENV
# - name: Singularity - Define Repository Name and Release Version
# run: |
# repo=$(echo "${GITHUB_REPOSITORY/\//-}")
# release=$(cat VERSION)
# echo "reponame=$repo" >> $GITHUB_ENV
# echo "release_tag=$release" >> $GITHUB_ENV
# - name: Singularity - Create Release
# id: create_release
# uses: actions/create-release@v1
# #if: ${{ env.release_tag != env.latest_tag }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.release_tag }}
# release_name: emma ${{ env.release_tag }}
# draft: false
# prerelease: false
# - uses: eWaterCycle/setup-singularity@v7
# #if: ${{ env.release_tag != env.latest_tag }}
# with:
# singularity-version: 3.8.3
# - name: Singularity - Build the container
# #if: ${{ env.release_tag != env.latest_tag }}
# run: |
# repo=$(echo "${GITHUB_REPOSITORY/\//-}")
# # For each Singularity* container, build based on the prefix (tag)
# for recipe in $(ls Singularity*); do
# echo "Building $recipe"
# tag=$(echo "${recipe/Singularity\./}")
# # If we find empty, use latest
# if [ "$tag" == "Singularity" ]; then
# tag=latest
# fi
# # Build the container and name by tag
# echo "Tag is $tag."
# container="$repo:$tag.sif"
# container_zip="$repo-$tag.sif.zip" #add zip file name for compression later
# singularity build --fakeroot container.sif "$recipe"
# if [ "$?" == "0" ]; then
# echo "Successfully built container $container."
# mv container.sif "$container"
# zip -9 ./"$container_zip" "$container"
# else
# echo "There was an issue building $container."
# fi
# done
# - name: Singularity - Upload Release Assets
# #if: ${{ env.release_tag != env.latest_tag }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# tag_name: ${{ env.release_tag }}
# run: |
# # select zip option below if sif is >2GB and can't fit as github release
# #hub release edit $(find . -type f -name "*.sif" -printf "-a %p ") -m "" "$tag_name"
# hub release edit $(find . -type f -name "*.sif.zip" -printf "-a %p ") -m "" "$tag_name"