Skip to content

generate-doi

generate-doi #6

Workflow file for this run

name: generate-doi
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight
workflow_dispatch:
jobs:
get-updated-apps:
runs-on: ubuntu-22.04
outputs:
app_batches: ${{ steps.list_apps.outputs.app_batches }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for apps to publish to Zenodo
id: list_apps
run: |
# Get the list of unpublished images from app.json
echo "Get the list of unpublished images..."
export APP_BATCHES=$(python .github/workflows/get-unpublished-apps.py --zenodo_token ${{ secrets.ZENODO_TOKEN }})
echo "app_batches=${APP_BATCHES}"
echo "app_batches=${APP_BATCHES}" >> $GITHUB_OUTPUT
publish-doi:
needs: get-updated-apps
runs-on: ubuntu-22.04
timeout-minutes: 1200
if: ${{ needs.get-updated-apps.outputs.app_batches != '[]' }}
strategy:
fail-fast: false
matrix:
app_batches: ${{ fromJSON(needs.get-updated-apps.outputs.app_batches) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests pyyaml>=6.0.2
- name : Publish singularity files in batch
shell: bash
run: |
echo "Apps to process: ${{ toJson(matrix.app_batches.apps) }}"
apps_json='${{ toJson(matrix.app_batches.apps) }}'
for app in $(echo "$apps_json" | jq -r '.[]'); do
echo " Processing app: $app with ${#app[@]} apps"
if curl --output /dev/null --silent --head --fail "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/${app}.simg"; then
# curl --output "$IMAGE_HOME/${app}.simg" "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/${app}.simg"
echo "Upload container ${app}.simg to Zenodo"
# echo $(find $IMAGE_HOME/${app}.simg)
export DOI_URL=$(python3 .github/workflows/publish-doi.py --container_filepath="https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/${app}.simg" --container_name=${app} --zenodo_token=${{ secrets.ZENODO_TOKEN }} --gh_token=${{ secrets.GITHUB_TOKEN }})
echo "DOI_URL: $DOI_URL"
else
echo "Container https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/${app}.simg not found. Skipping..."
fi
done