Skip to content

Commit

Permalink
Updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maouw committed Oct 20, 2023
1 parent cd3126c commit 885f093
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/apptainer-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ jobs:
contents: read
packages: write
steps:
- name: Delete huge unnecessary tools folder
- name: Get container name
run: |
cont_name=$(echo "${GITHUB_REF_NAME:-}" | sed -E 's/^sif-//; s/-.*$//')
echo "Container name is ${cont_name:-}"
if [ ! -r "${cont_name:-}/Singularity" ]; then
echo "No container named ${cont_name:-} found."
exit 1
fi
echo "cont_name=$cont_name" >> $GITHUB_ENV
- name: Delete GitHub AGENT_TOOLSDIRECTORY to free space
run: |
echo "Disk space before:" && df -h
sudo rm -rf /opt/hostedtoolcache; echo "Done removing /opt/hostedtoolcache"
Expand All @@ -29,10 +38,8 @@ jobs:
- name: Build Container
run: |
echo "Disk space before:" && df -h
cont_name=$(echo "${GITHUB_REF_NAME:-}" | sed -E 's/^sif-//; s/-.*$//')
echo "Container name is $cont_name."
[ -d "${cont_name:-}" ] || exit 1
pushd "${cont_name}"
echo "Building ${cont_name}.sif"
apptainer build --fakeroot --fix-perms --warn-unused-build-args --build-arg BOOTSTRAP_SOURCE=oras BOOTSTRAP_REPO="ghcr.io/${{ github.repository }}" ../${cont_name}.sif Singularity
echo "Built ${cont_name}.sif"
popd
Expand All @@ -41,7 +48,6 @@ jobs:
tag="${tag:-latest}"
echo "Tag is $tag."
echo "tag=$tag" >> $GITHUB_ENV
echo "cont_name=$cont_name" >> $GITHUB_ENV
echo "Disk space after:" && df -h
- name: Login and Deploy Container
run: |
Expand Down

0 comments on commit 885f093

Please sign in to comment.