deploy #64
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: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| repository_dispatch: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 6 * * 1' # Weekly Monday 06:00 UTC | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout site | |
| uses: actions/checkout@v6 | |
| - name: Checkout schemas | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ISO-TC211/schemas | |
| path: schemas | |
| - name: Compute build cache key | |
| id: cache-key | |
| run: | | |
| SCHEMAS_SHA=$(git -C schemas rev-parse HEAD) | |
| echo "schemas_sha=${SCHEMAS_SHA}" >> "$GITHUB_OUTPUT" | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| - name: Cache LXR/SPA build artifacts | |
| uses: actions/cache@v4 | |
| id: lxr-cache | |
| with: | |
| path: | | |
| build/ | |
| site/ | |
| configs/ | |
| schemas_index.json | |
| resources_index.json | |
| key: lxr-v1-${{ hashFiles('generate_configs.rb', 'schemas/lxr_packages.yml', 'schemas/ljr_packages.yml', 'schemas/Gemfile.lock', 'Makefile') }}-${{ steps.cache-key.outputs.schemas_sha }} | |
| - name: Setup Ruby (lutaml) | |
| if: steps.lxr-cache.outputs.cache-hit != 'true' | |
| run: BUNDLE_GEMFILE=schemas/Gemfile BUNDLE_PATH=vendor/bundle-lutaml bundle install | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build lutaml frontends | |
| if: steps.lxr-cache.outputs.cache-hit != 'true' | |
| run: | | |
| for gem_name in lutaml-jsonschema lutaml-xsd; do | |
| GEM_DIR=$(BUNDLE_GEMFILE=schemas/Gemfile BUNDLE_PATH=vendor/bundle-lutaml bundle show "$gem_name" 2>/dev/null) || continue | |
| [ -d "$GEM_DIR/frontend" ] || continue | |
| cd "$GEM_DIR/frontend" | |
| npm install | |
| npm run build | |
| cd - | |
| done | |
| - name: Build LXR packages and SPAs | |
| if: steps.lxr-cache.outputs.cache-hit != 'true' | |
| run: make configs lxr-spas | |
| - name: Build Jekyll site | |
| run: JEKYLL_ENV=production bundle exec jekyll build | |
| - name: Upload site artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site | |
| path: _site/ | |
| retention-days: 1 | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site | |
| path: _site/ | |
| - name: Package for Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| link_checker: | |
| needs: build | |
| if: github.event_name != 'repository_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download site artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site | |
| path: _site/ | |
| - name: Restore lychee cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: Link Checker | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: >- | |
| --verbose | |
| --no-progress | |
| --base '${{ github.workspace }}/_site' | |
| --root-dir '${{ github.workspace }}/_site' | |
| --cache | |
| --max-cache-age 1d | |
| --exclude 'https://committee\.iso\.org/' | |
| --exclude 'https://www\.facebook\.com/' | |
| --exclude 'https://twitter\.com/' | |
| --exclude 'http://iso\.sparxcloud\.com/' | |
| --exclude 'https://lutaml\.github\.io/' | |
| --exclude '%23' | |
| --exclude '.+/resources/?.*' | |
| '_site/**/*.html' | |
| fail: true |