11name : Sync OpenMS Containers
22
33on :
4+ push :
5+ branches : [ "main" ]
6+ release :
7+ types : [published]
48 workflow_dispatch :
59 inputs :
610 push_release :
6064 docker push $TARGET_CONTAINER
6165 }
6266
63- # If this is a release push, also tag as latest
64- if [[ "${{ github.event.inputs.push_release }}" == "true" ]]; then
67+ # If this is a release push or a GitHub release event , also tag as latest
68+ if [[ "${{ github.event.inputs.push_release }}" == "true" || "${{ github.event_name }}" == "release" ]]; then
6569 LATEST_IMAGE="ghcr.io/bigbio/openms-tools-thirdparty:latest"
6670 docker tag $SOURCE_CONTAINER $LATEST_IMAGE
6771 docker push $LATEST_IMAGE || {
7882 with :
7983 singularity-version : 3.8.7
8084
81- - name : Configure Singularity for GitHub Container Registry
82- if : success()
83- run : |
84- # Create Singularity remote endpoint for GitHub Container Registry
85- singularity remote add --no-login GithubContainer oras://ghcr.io
86-
87- # Login to GitHub Container Registry
88- echo "${{ secrets.GHCR_TOKEN }}" | singularity remote login -u ${{ github.actor }} --password-stdin GithubContainer
89-
9085 - name : Pull OpenMS SIF container
9186 id : pull_sif
9287 if : success()
@@ -97,28 +92,29 @@ jobs:
9792 retry_wait_seconds : 60
9893 command : singularity pull --force openms-tools-thirdparty.sif oras://ghcr.io/openms/openms-tools-thirdparty-sif:latest
9994
100- - name : Push OpenMS SIF container
95+ - name : Login and Push OpenMS SIF container
10196 if : steps.pull_sif.outcome == 'success'
97+ env :
98+ keepgoing : true
10299 run : |
103- # Set SIF paths
104- TARGET_SIF="oras://ghcr.io/bigbio/openms-tools-thirdparty-sif: ${{ steps.date.outputs.DATE_TAG }}"
100+ # Login to GitHub Container Registry
101+ echo ${{ secrets.GHCR_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
105102
106- echo "Pushing to $TARGET_SIF"
107- # Convert the oras:// URL to use the GithubContainer remote
108- TARGET_REMOTE_SIF=$(echo $TARGET_SIF | sed 's|oras://ghcr.io|oras://GithubContainer|')
109- singularity push openms-tools-thirdparty.sif $TARGET_REMOTE_SIF || {
110- echo "Failed to push $TARGET_REMOTE_SIF, retrying..."
103+ # Set SIF paths and push with date tag
104+ echo "Pushing OpenMS SIF with date tag"
105+ singularity push openms-tools-thirdparty.sif oras://bigbio/openms-tools-thirdparty-sif:${{ steps.date.outputs.DATE_TAG }} || {
106+ echo "Failed to push with date tag, retrying..."
111107 sleep 60
112- singularity push openms-tools-thirdparty.sif $TARGET_REMOTE_SIF
108+ singularity push openms-tools-thirdparty.sif oras://bigbio/openms-tools-thirdparty-sif:${{ steps.date.outputs.DATE_TAG }}
113109 }
114110
115- # If this is a release push, also tag as latest
116- if [[ "${{ github.event.inputs.push_release }}" == "true" ]]; then
117- LATEST_SIF="oras://GithubContainer/bigbio/openms-tools-thirdparty-sif: latest"
118- singularity push openms-tools-thirdparty.sif $LATEST_SIF || {
119- echo "Failed to push $LATEST_SIF , retrying..."
111+ # If this is a release push or a GitHub release event , also tag as latest
112+ if [[ "${{ github.event.inputs.push_release }}" == "true" || "${{ github.event_name }}" == "release" ]]; then
113+ echo "Pushing OpenMS SIF as latest"
114+ singularity push openms-tools-thirdparty.sif oras://bigbio/openms-tools-thirdparty-sif:latest || {
115+ echo "Failed to push as latest , retrying..."
120116 sleep 60
121- singularity push openms-tools-thirdparty.sif $LATEST_SIF
117+ singularity push openms-tools-thirdparty.sif oras://bigbio/openms-tools-thirdparty-sif:latest
122118 }
123119 echo "Pushed release version as $LATEST_SIF"
124120 fi
0 commit comments