Skip to content

shpc update containers #577

shpc update containers

shpc update containers #577

Workflow file for this run

name: shpc update containers
on:
workflow_dispatch:
schedule:
# Now daily for a smaller subset of containers
- cron: '0 23 * * *'
jobs:
auto-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install Dependencies
run: pip install git+https://github.com/singularityhub/singularity-hpc@main
- name: Shpc Listing
run: |
# Remove default remote registry and add PWD
shpc config remove registry https://github.com/singularityhub/shpc-registry
shpc config add registry $(pwd)
shpc show > listing.txt
# Run a specific letter matched to a day of the month A==1, Z==26
- name: Calendar Updater
uses: vsoch/split-list-action@main
with:
ids_file: listing.txt
outfile: shpc-show-subset.txt
# One letter assigned to each day
calendar_split: true
- name: Run Update on Subset
run: |
for entry in $(cat ./shpc-show-subset.txt); do
echo "Updating ${entry}"
if [[ "${entry}" == "" ]]; then
continue
fi
shpc update ${entry}
done
rm listing.txt
rm shpc-show-subset.txt
- name: Checkout Update branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
printf "GitHub Actor: ${GITHUB_ACTOR}\n"
export BRANCH_FROM="containers/update-$(date '+%Y-%m-%d')"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git branch
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
git add ./*
git status
if git diff-index --quiet HEAD --; then
printf "No changes\n"
else
printf "Changes\n"
git commit -a -m "Automated deployment to update containers $(date '+%Y-%m-%d')"
git push origin main
fi