|
8 | 8 | build-test-containers: |
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | strategy: |
11 | | - # Keep going on other deployments if anything bloops |
12 | 11 | fail-fast: false |
13 | 12 | matrix: |
| 13 | + # Must match an existing tag on quay.io/singularity/singularity (full semver, e.g. 4.1.0 not 4.0). |
14 | 14 | singularity_version: |
15 | | - - '4.0' |
| 15 | + - '4.1.0' |
16 | 16 |
|
17 | 17 | container: |
18 | 18 | image: quay.io/singularity/singularity:v${{ matrix.singularity_version }} |
19 | 19 | options: --privileged |
20 | 20 |
|
21 | 21 | steps: |
22 | | - |
23 | 22 | - name: Check out code for the container builds |
24 | | - uses: actions/checkout@v2 |
| 23 | + uses: actions/checkout@v4 |
25 | 24 | with: |
26 | 25 | submodules: recursive |
27 | 26 |
|
28 | | - - name: Build Container |
| 27 | + - name: Verify Singularity definition exists |
29 | 28 | run: | |
30 | | - if [ -f Singularity ]; then |
31 | | - sudo -E singularity build container.sif Singularity |
32 | | - else |
33 | | - echo "Singularity is not found." |
34 | | - echo "Present working directory: $PWD" |
35 | | - ls |
36 | | - fi |
37 | | - |
| 29 | + if [ ! -f Singularity ]; then |
| 30 | + echo "Singularity definition file not found in $(pwd)" |
| 31 | + ls -la |
| 32 | + exit 1 |
| 33 | + fi |
| 34 | +
|
| 35 | + - name: Build Container |
| 36 | + run: sudo -E singularity build container.sif Singularity |
| 37 | + |
38 | 38 | - name: Set Tag Based on Branch Name |
39 | 39 | run: | |
40 | | - # Get the branch name and set it as the tag |
41 | 40 | tag=${GITHUB_REF##*/}-singularity |
42 | 41 | echo "Tag is $tag." |
43 | 42 | echo "tag=$tag" >> $GITHUB_ENV |
44 | 43 |
|
45 | 44 | - name: Login and Deploy Container |
46 | 45 | if: (github.event_name != 'pull_request') |
47 | 46 | run: | |
48 | | - echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io |
49 | | - container_name=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]') |
50 | | - singularity push container.sif oras://ghcr.io/${container_name}:${tag} |
| 47 | + echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io |
| 48 | + container_name=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]') |
| 49 | + singularity push container.sif oras://ghcr.io/${container_name}:${tag} |
0 commit comments