-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (67 loc) · 2.43 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: singularity-deploy
on:
push:
branches:
- "main"
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: |
release=$(cat VERSION)
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.7.1
- name: Build the singularity container
if: ${{ env.release_tag != env.latest_tag }}
run: |
# 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="$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"