Add README project index generation #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate IIIF Manifests | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags-ignore: | |
| - "*" | |
| paths: | |
| - "projects/**/images/**" | |
| - "projects/**/info.yml" | |
| - "scripts/**" | |
| - "package.json" | |
| - ".github/workflows/generate-manifests.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate: | |
| if: ${{ github.event_name != 'push' || (!contains(github.event.head_commit.message, '[skip manifests]') && !contains(github.event.head_commit.message, '[skip ci]')) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate all manifests | |
| if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[manifests-local]') }} | |
| env: | |
| SITE_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} | |
| run: npm run generate:all | |
| - name: Validate all manifests | |
| run: npm run validate:all | |
| - name: Verify local-generated manifests are current | |
| if: ${{ github.event_name == 'push' && contains(github.event.head_commit.message, '[manifests-local]') }} | |
| env: | |
| SITE_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} | |
| run: | | |
| npm run generate:all | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "[manifests-local] was set but generated outputs were not up to date." | |
| git status --porcelain | |
| exit 1 | |
| fi | |
| - name: Commit generated files | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add projects/**/manifest.json projects/**/README.md projects/**/WARNING.md | |
| git commit -m "chore: regenerate manifests" | |
| git push | |
| else | |
| echo "No generated changes to commit" | |
| fi |