Skip to content

Commit d19fd58

Browse files
Refactor build-singularity step in workflow
1 parent a70ca59 commit d19fd58

1 file changed

Lines changed: 17 additions & 23 deletions

File tree

.github/workflows/build-containers.yml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,26 @@ jobs:
5555
build-singularity:
5656
needs: build-docker
5757
runs-on: ubuntu-latest
58+
permissions:
59+
contents: read
60+
packages: read
5861
steps:
59-
- name: Checkout repository
60-
uses: actions/checkout@v4
61-
62-
# Add this step to ensure the image name is lowercase here as well
62+
- uses: actions/checkout@v4
63+
6364
- name: Set lower case owner name
64-
run: |
65-
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
66-
67-
- name: Setup Apptainer/Singularity
68-
uses: eWaterCycle/setup-apptainer@v2
65+
run: echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
66+
67+
- uses: eWaterCycle/setup-apptainer@v2
6968
with:
7069
apptainer-version: 1.2.2
71-
72-
- name: Build Singularity Image
73-
# Note: We pull the exact tag generated in the Docker build step
70+
71+
- name: Login to GHCR for Apptainer
7472
run: |
75-
IMAGE_URL="docker://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main"
76-
apptainer build micaflow.sif $IMAGE_URL
77-
78-
- name: Test Singularity Image
73+
apptainer registry login ghcr.io \
74+
--username "${{ github.actor }}" \
75+
--password "${{ secrets.GITHUB_TOKEN }}"
76+
77+
- name: Build Singularity Image
7978
run: |
80-
apptainer exec micaflow.sif pytest tests/test_cli_interface.py
81-
82-
- name: Upload Singularity Artifact
83-
uses: actions/upload-artifact@v4
84-
with:
85-
name: micaflow-singularity
86-
path: micaflow.sif
79+
IMAGE_URL="docker://ghcr.io/${{ env.IMAGE_NAME }}:main"
80+
apptainer build micaflow.sif "$IMAGE_URL"

0 commit comments

Comments
 (0)