Skip to content

Commit c162e49

Browse files
committed
update singularity latest tag on release
1 parent b940bc0 commit c162e49

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/image-release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,60 @@ jobs:
119119
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
120120
singularity push container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag}
121121
fi
122+
123+
singularity-latest:
124+
needs: docker
125+
runs-on: ubuntu-latest
126+
container:
127+
image: quay.io/singularity/singularity:v3.10.4
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
recipe: ["Singularity"]
132+
133+
name: Check ${{ matrix.recipe }}
134+
steps:
135+
136+
- name: Check out code for the container build
137+
uses: actions/checkout@v3
138+
139+
- name: Continue if Singularity Recipe Exists
140+
run: |
141+
if [[ -f "${{ matrix.recipe }}" ]]; then
142+
echo "keepgoing=true" >> $GITHUB_ENV
143+
fi
144+
145+
- name: Create tag for Singularity
146+
env:
147+
recipe: ${{ matrix.recipe }}
148+
run: |
149+
ls
150+
if [ -f "${{ matrix.recipe }}" ]; then
151+
sudo -E singularity build container.sif ${{ matrix.recipe }}
152+
tag=$(echo "${recipe/Singularity\./}")
153+
if [ "$tag" == "Singularity" ]; then
154+
tag=latest
155+
fi
156+
# Build the container and name by tag
157+
echo "Tag is $tag."
158+
echo "tag=$tag" >> $GITHUB_ENV
159+
else
160+
echo "${{ matrix.recipe }} is not found."
161+
echo "Present working directory: $PWD"
162+
ls
163+
fi
164+
165+
- name: Update Singularity file tag
166+
run: |
167+
sed -i "s/latest/$tag/" ./Singularity
168+
169+
- name: Login and Deploy Container
170+
#if: (github.event_name != 'pull_request')
171+
env:
172+
keepgoing: ${{ env.keepgoing }}
173+
run: |
174+
if [[ "${keepgoing}" == "true" ]]; then
175+
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
176+
singularity push container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag}
177+
fi
178+

0 commit comments

Comments
 (0)