Skip to content

Use the latest MATLAB release to maintain compatibility (#47) #43

Use the latest MATLAB release to maintain compatibility (#47)

Use the latest MATLAB release to maintain compatibility (#47) #43

Workflow file for this run

name: Build gallery
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
release:
if: github.repository == 'TopoToolbox/gallery'
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: TopoToolbox/actions/checkout@main
with:
fetch-depth: 0
fetch-tags: true # Fetch all the tags so that we compute release number correctly
- name: Generate tag
id: tag
run: |
PREFIX="release-$(date +'%Y%m%d')-"
MAX=$(git tag -l "${PREFIX}*" | sed -E "s/^${PREFIX}([0-9]+)/\1/" | sort -n | tail -n1)
NEXT=$((${MAX:-0} + 1))
NEW_TAG="${PREFIX}${NEXT}"
echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT
echo "TAG=$NEW_TAG" >> $GITHUB_ENV
echo "This release will be tagged: $NEW_TAG"
- name: Create release
run: |
gh release create $TAG --target main --generate-notes --latest
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: TopoToolbox/actions/checkout@main
- name: Restore data cache
uses: TopoToolbox/actions/cache@main
with:
path: ~/.cache/topotoolbox
key: tt3-gallery-data
- name: Install Pandoc
run: sudo apt-get install -y pandoc
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
pip install -r ${{ github.workspace }}/requirements.txt
- name: Ensure API key is available for examples that require it
env:
OPENTOPOGRAPHY_API_KEY: ${{ secrets.OPENTOPOGRAPHY_API_KEY }}
run: |
printf '%s' "$OPENTOPOGRAPHY_API_KEY" > $HOME/.opentopography.txt
mkdir -p $HOME/.matlab/R2025b
cp $HOME/.opentopography.txt $HOME/.matlab/R2025b/opentopography.apikey
- name: Setup MATLAB
uses: TopoToolbox/actions/setup-matlab@main
with:
release: latest
cache: true
products: |
Mapping_Toolbox
Image_Processing_Toolbox
Optimization_Toolbox
Statistics_and_Machine_Learning_Toolbox
- name: Run MATLAB build
uses: TopoToolbox/actions/run-build@main
- name: Build sphinx documentation
run: |
make clean
make html
- name: Package artifact
uses: TopoToolbox/actions/upload-pages-artifact@main
with:
path: ${{ github.workspace }}/build/html
deploy:
if: ${{ github.repository_owner == 'TopoToolbox' }}
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: TopoToolbox/actions/deploy-pages@main