-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from hmgu-itg/singularity-deploy
Added singularity-deploy related files
- Loading branch information
Showing
3 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: singularity-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- "stable" | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: 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: 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: 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: Release ${{ env.release_tag }} | ||
draft: false | ||
prerelease: false | ||
- uses: eWaterCycle/setup-singularity@v6 | ||
if: ${{ env.release_tag != env.latest_tag }} | ||
with: | ||
singularity-version: 3.6.4 | ||
- name: Build the singularity 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" | ||
singularity build --fakeroot container.sif "$recipe" | ||
if [ "$?" == "0" ]; then | ||
echo "Successfully built container $container." | ||
mv container.sif "$container" | ||
else | ||
echo "There was an issue building $container." | ||
fi | ||
done | ||
- name: 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: | | ||
hub release edit $(find . -type f -name "*.sif" -printf "-a %p ") -m "" "$tag_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.5.1 |