-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (33 loc) · 1.19 KB
/
apptainer-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Singularity Build
on:
push:
# Edit the branches here if you want to change deploy behavior
branches:
- main
- master
tags:
- release-*
jobs:
build-and-push-image:
runs-on: ubuntu-latest
name: Build Apptainer image
permissions:
contents: read
packages: write
steps:
- name: Install Apptainer
run: deb=$(curl -w "%{filename_effective}" -LO https://github.com/apptainer/apptainer/releases/download/v1.2.4/apptainer_1.2.4_amd64.deb) && sudo apt install -y "./$deb"; rm -f "$deb"; unset deb
- name: Check out code for the container build
uses: actions/checkout@v4
- name: Build Container
run: |
apptainer build container.sif Singularity
tag=$(echo "${recipe/Singularity\./}")
[ "$tag" == "Singularity" ] && tag=latest
# Build the container and name by tag
echo "Tag is $tag."
echo "tag=$tag" >> $GITHUB_ENV
- name: Login and Deploy Container
run: |
apptainer remote login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} oras://ghcr.io
apptainer push container.sif oras://ghcr.io/${{ github.repository }}:${tag}