Skip to content

Commit 3d5e4fb

Browse files
authored
Update Singularity publish workflow for clarity
1 parent d3c568d commit 3d5e4fb

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

.github/workflows/singularity-publish.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ name: Upload Singularity Images
22

33
on:
44
workflow_run:
5-
workflows: ["Upload Docker Images"]
5+
workflows: ["Upload Docker image"]
66
types: [completed]
77
branches: [main, master]
88
workflow_dispatch:
99
inputs:
1010
release_tag:
11-
description: 'Release tag to build Singularity image for'
12-
required: true
11+
description: 'Release tag to build Singularity image for (leave empty to build from current branch and tag as latest)'
12+
required: false
1313
type: string
1414

1515
concurrency:
@@ -21,15 +21,15 @@ jobs:
2121
name: Push Singularity image to registry
2222
runs-on: ubuntu-latest
2323
# Only run if the Docker workflow succeeded, or if manually triggered
24-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
25-
permissions:
24+
if: ${{ github.event_name == 'workflow_dispatch' || github.event. workflow_run.conclusion == 'success' }}
25+
permissions:
2626
packages: write
2727
contents: read
28-
steps:
28+
steps:
2929
- name: Check out the repo
3030
uses: actions/checkout@v3
3131
with:
32-
ref: ${{ github. event.inputs.release_tag || github.event.workflow_run.head_branch }}
32+
ref: ${{ github.event.inputs.release_tag || github.event.workflow_run.head_branch }}
3333

3434
- name: Set up Singularity
3535
uses: eWaterCycle/setup-singularity@v7
@@ -44,24 +44,26 @@ jobs:
4444
id: tag
4545
run: |
4646
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
47-
TAG="${{ github.event. inputs.release_tag }}"
47+
if [ -n "${{ github.event.inputs.release_tag }}" ]; then
48+
TAG="${{ github.event.inputs.release_tag }}"
49+
else
50+
TAG="latest"
51+
fi
4852
else
4953
# Extract tag from the triggering workflow
5054
TAG="${{ github.event.workflow_run.head_branch }}"
5155
fi
5256
echo "tag=${TAG}" >> $GITHUB_OUTPUT
5357
5458
- name: Build and push Singularity images
55-
run: |
56-
TAG="${{ steps.tag.outputs. tag }}"
59+
run: |
60+
TAG="${{ steps. tag.outputs.tag }}"
5761
5862
# Build Singularity image from the Docker image
59-
singularity build pyprophet.sif docker://ghcr.io/${{ github.repository }}:${TAG}
63+
singularity build pyprophet. sif docker://ghcr.io/${{ github.repository }}: ${TAG}
6064
6165
# Push to GHCR with -sif suffix
6266
singularity push pyprophet.sif oras://ghcr.io/${{ github.repository }}-sif:${TAG}
6367
64-
# Also tag as latest if appropriate
65-
if [ "${{ github.event_name }}" == "workflow_run" ] || [ -n "${{ github. event.inputs.release_tag }}" ]; then
66-
singularity push pyprophet. sif oras://ghcr.io/${{ github.repository }}-sif:latest
67-
fi
68+
# Also tag as latest (always)
69+
singularity push pyprophet.sif oras://ghcr.io/${{ github.repository }}-sif:latest

0 commit comments

Comments
 (0)