Skip to content

Build and Run Apptainer #10

Build and Run Apptainer

Build and Run Apptainer #10

Workflow file for this run

name: Build and Run Apptainer
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Apptainer from PPA repository
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt-get update
sudo apt-get install -y apptainer
- name: Build Apptainer image
run: |
ls -lah
apptainer build crpropa.sif crpropa.def
# We expect that this action is run in a repository manually, so there is no release or tag available.
# Here we create tag from timestamp, and then the release is created with the tag.
- name: Create tag
id: create_tag
uses: actions/github-script@v5
with:
script: |
const date = new Date();
const timestamp = date.toISOString().replace(/[:.]/g, '-');
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${timestamp}`,
sha: context.sha
});
return timestamp;
- name: Release
uses: softprops/action-gh-release@v2
with:
files: crpropa.sif
tag_name: ${{ steps.create_tag.outputs.result }}