2727
2828env :
2929 REGISTRY : ghcr.io
30- IMAGE_NAME : ${{ github.repository_owner }}/diann
31- SINGULARITY_IMAGE_NAME : ${{ github.repository_owner }}/diann-sif
3230jobs :
3331 # ── Detect which Dockerfiles changed ───────────────────────────────────
3432 detect-changes :
@@ -118,10 +116,6 @@ jobs:
118116 max-parallel : 1
119117 matrix : ${{ fromJSON(needs.detect-changes.outputs.diann_matrix) }}
120118
121- env :
122- RETRY_TIMES : 3
123- RETRY_DELAY : 30
124-
125119 steps :
126120 - name : Checkout repository
127121 uses : actions/checkout@v4
@@ -135,24 +129,11 @@ jobs:
135129 username : ${{ github.actor }}
136130 password : ${{ secrets.GITHUB_TOKEN }}
137131
138- - name : Extract metadata for Docker
139- id : meta
140- uses : docker/metadata-action@v5
141- with :
142- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
143- tags : |
144- type=raw,value=latest,enable={{is_default_branch}}
145- type=raw,value={{date 'YYYY.MM.DD'}}
146-
147- - name : Set date tag
148- id : date
149- run : echo "DATE_TAG=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
150-
151132 - name : Build and Push DiaNN ${{ matrix.context }} image
152133 uses : docker/build-push-action@v5
153134 with :
154135 context : ./${{ matrix.context }}
155- push : ${{ ( github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
136+ push : ${{ github.event_name != 'pull_request' }}
156137 load : true
157138 tags : |
158139 ${{ matrix.tag }}
@@ -162,29 +143,26 @@ jobs:
162143 provenance : false
163144
164145 - name : Set up Singularity
165- if : ${{ ( github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
146+ if : github.event_name != 'pull_request'
166147 uses : eWaterCycle/setup-singularity@v7
167148 with :
168149 singularity-version : 3.8.7
169150
170- - name : Pull Docker image for Singularity conversion
171- if : ${{ ( github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
151+ - name : Save Docker image for Singularity conversion
152+ if : github.event_name != 'pull_request'
172153 run : |
173- # Pull the Docker image from GitHub Container Registry
174- docker pull ${{ matrix.tag }}
175- # Save the Docker image to a tar file
176154 docker save ${{ matrix.tag }} -o ${{ matrix.context }}.tar
177155
178156 - name : Convert Docker image to Singularity
179- if : ${{ ( github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
157+ if : github.event_name != 'pull_request'
180158 run : |
181159 # Convert Docker tar to Singularity SIF
182160 singularity build ${{ matrix.context }}.sif docker-archive://${{ matrix.context }}.tar
183161 # Verify the SIF file exists
184162 ls -la ${{ matrix.context }}.sif
185163
186164 - name : Login and Deploy Container
187- if : ${{ ( github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
165+ if : github.event_name != 'pull_request'
188166 run : |
189167 echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
190168
@@ -229,7 +207,7 @@ jobs:
229207 uses : docker/login-action@v3
230208 with :
231209 registry : ghcr.io
232- username : ${{ github.repository_owner }}
210+ username : ${{ github.actor }}
233211 password : ${{ secrets.GITHUB_TOKEN }}
234212
235213 - name : Build and push Docker image
@@ -245,18 +223,24 @@ jobs:
245223 cache-to : type=gha,scope=${{ matrix.context }},mode=max
246224 provenance : false
247225
226+ - name : Set up Singularity
227+ if : github.event_name != 'pull_request'
228+ uses : eWaterCycle/setup-singularity@v7
229+ with :
230+ singularity-version : 3.8.7
231+
248232 - name : Convert to Singularity and push
249233 if : github.event_name != 'pull_request'
250234 run : |
251- sudo apt-get update && sudo apt-get install -y singularity-container || true
252235 docker save ${{ matrix.tag }} -o image.tar
253236 singularity build image.sif docker-archive://image.tar
254- export SINGULARITY_DOCKER_USERNAME=${{ github.actor }}
255- export SINGULARITY_DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }}
256- singularity push image.sif oras://ghcr.io/bigbio/${{ matrix.sif }}
237+
238+ echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
239+
240+ singularity push image.sif oras://ghcr.io/${{ github.repository_owner }}/${{ matrix.sif }}
257241 if [[ "${{ github.event_name }}" == "release" && -n "${{ matrix.extra_tags }}" ]]; then
258242 SIF_LATEST=$(echo "${{ matrix.sif }}" | sed 's/:[^:]*$/:latest/')
259- singularity push image.sif oras://ghcr.io/bigbio /$SIF_LATEST
243+ singularity push image.sif oras://ghcr.io/${{ github.repository_owner }} /$SIF_LATEST
260244 fi
261245
262246 # ── Sync OpenMS containers (after everything else) ─────────────────────
@@ -278,7 +262,7 @@ jobs:
278262 uses : docker/login-action@v3
279263 with :
280264 registry : ghcr.io
281- username : ${{ github.repository_owner }}
265+ username : ${{ github.actor }}
282266 password : ${{ secrets.GITHUB_TOKEN }}
283267
284268 - name : Pull, tag, and push OpenMS Docker
@@ -289,22 +273,26 @@ jobs:
289273 retry_wait_seconds : 30
290274 command : |
291275 docker pull ghcr.io/openms/openms-tools-thirdparty:latest
292- docker tag ghcr.io/openms/openms-tools-thirdparty:latest ghcr.io/bigbio /openms-tools-thirdparty:${{ env.OPENMS_VERSION }}
293- docker push ghcr.io/bigbio /openms-tools-thirdparty:${{ env.OPENMS_VERSION }}
276+ docker tag ghcr.io/openms/openms-tools-thirdparty:latest ghcr.io/${{ github.repository_owner }} /openms-tools-thirdparty:${{ env.OPENMS_VERSION }}
277+ docker push ghcr.io/${{ github.repository_owner }} /openms-tools-thirdparty:${{ env.OPENMS_VERSION }}
294278
295279 - name : Tag as latest on release
296280 if : github.event_name == 'release'
297281 run : |
298- docker tag ghcr.io/openms/openms-tools-thirdparty:latest ghcr.io/bigbio/openms-tools-thirdparty:latest
299- docker push ghcr.io/bigbio/openms-tools-thirdparty:latest
282+ docker tag ghcr.io/openms/openms-tools-thirdparty:latest ghcr.io/${{ github.repository_owner }}/openms-tools-thirdparty:latest
283+ docker push ghcr.io/${{ github.repository_owner }}/openms-tools-thirdparty:latest
284+
285+ - name : Set up Singularity
286+ uses : eWaterCycle/setup-singularity@v7
287+ with :
288+ singularity-version : 3.8.7
300289
301290 - name : Sync OpenMS Singularity
302291 run : |
303- sudo apt-get update && sudo apt-get install -y singularity-container || true
304- export SINGULARITY_DOCKER_USERNAME=${{ github.actor }}
305- export SINGULARITY_DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }}
292+ echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
293+
306294 singularity pull --force openms.sif oras://ghcr.io/openms/openms-tools-thirdparty-sif:latest
307- singularity push openms.sif oras://ghcr.io/bigbio /openms-tools-thirdparty-sif:${{ env.OPENMS_VERSION }}
295+ singularity push openms.sif oras://ghcr.io/${{ github.repository_owner }} /openms-tools-thirdparty-sif:${{ env.OPENMS_VERSION }}
308296 if [[ "${{ github.event_name }}" == "release" ]]; then
309- singularity push openms.sif oras://ghcr.io/bigbio /openms-tools-thirdparty-sif:latest
297+ singularity push openms.sif oras://ghcr.io/${{ github.repository_owner }} /openms-tools-thirdparty-sif:latest
310298 fi
0 commit comments