Fix sitemap validation (use Python instead of xmllint), revert XSL to… #392
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
| # Syncs OpenAPI specs and docs to ReadMe.com on every push to a version branch, | |
| # then generates and deploys static files (sitemap.xml, robots.txt, llms.txt, | |
| # llms-full.txt) to the api.seatable.com vserver via rsync. | |
| # | |
| # Documentation: https://docs.readme.com/docs/rdme or https://github.com/readmeio/rdme | |
| # | |
| # The version is derived from the branch name (e.g. v6.2 -> 6.2). | |
| # The ReadMe category IDs are stored in .github/readme-ids.json (one per branch). | |
| # | |
| # Process for new version: | |
| # 1. git checkout -b vX.Y | |
| # 2. Login to https://dash.readme.com/login and fork the API definition to the new version. | |
| # 3. Get the new category IDs from https://dash.readme.com/project/seatable/vX.Y/reference | |
| # or via API: https://docs.readme.com/main/reference/getcategories | |
| # (use the API key from https://dash.readme.com/project/seatable/vX.Y/api-key as password - username stays empty) | |
| # 4. Update .github/readme-ids.json with the new IDs. | |
| # 5. Update the "category" value in all intro/*.md frontmatter. | |
| # 6. Update the version in all YAML spec files. | |
| # 7. git add . && git commit && git push --set-upstream origin vX.Y | |
| name: Publish | |
| on: | |
| push: | |
| branches: | |
| - "v*" | |
| jobs: | |
| # ----------------------------------------------------------------------- | |
| # Job 1: Publish OpenAPI specs and docs to ReadMe.com | |
| # ----------------------------------------------------------------------- | |
| publish: | |
| name: Publish to ReadMe | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Derive version from branch name | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "Deploying version: ${VERSION}" | |
| - name: Read ReadMe IDs from config | |
| run: | | |
| echo "ID_AUTH=$(jq -r '.authentication' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_BASE=$(jq -r '.base_operations' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_FILE=$(jq -r '.file_operations' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_SYSADMIN=$(jq -r '.system_admin_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_TEAMADMIN=$(jq -r '.team_admin_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_USER=$(jq -r '.user_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_PING=$(jq -r '.ping_and_info' .github/readme-ids.json)" >> $GITHUB_ENV | |
| echo "ID_PYTHON=$(jq -r '.python_scheduler' .github/readme-ids.json)" >> $GITHUB_ENV | |
| - name: Check links in docs and specs | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| args: "--verbose --no-progress --scheme https --exclude-path 'intro/changelog.md' './intro/*.md' './*.yaml'" | |
| fail: true | |
| - name: Validate OpenAPI specs | |
| run: | | |
| npx --yes swagger-cli validate authentication.yaml | |
| npx --yes swagger-cli validate base_operations.yaml | |
| npx --yes swagger-cli validate file_operations.yaml | |
| npx --yes swagger-cli validate system_admin_account_operations.yaml | |
| npx --yes swagger-cli validate team_admin_account_operations.yaml | |
| npx --yes swagger-cli validate user_account_operations.yaml | |
| npx --yes swagger-cli validate ping_and_info.yaml | |
| npx --yes swagger-cli validate python-scheduler.yaml | |
| - name: Update SeaTable API docs | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: docs ./intro --key=${{ secrets.README_API_KEY }} --version=${{ env.VERSION }} | |
| - name: Update authentication | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi authentication.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_AUTH }} --useSpecVersion | |
| - name: Update base operations | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi base_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_BASE }} --useSpecVersion | |
| - name: Update file operations | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi file_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_FILE }} --useSpecVersion | |
| - name: Update sys admin account operations | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi system_admin_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_SYSADMIN }} --useSpecVersion | |
| - name: Update team admin account operations | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi team_admin_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_TEAMADMIN }} --useSpecVersion | |
| - name: Update user account operations | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi user_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_USER }} --useSpecVersion | |
| - name: Update ping & info | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi ping_and_info.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_PING }} --useSpecVersion | |
| - name: Update python scheduler | |
| uses: readmeio/rdme@v9 | |
| with: | |
| rdme: openapi python-scheduler.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_PYTHON }} --useSpecVersion | |
| # ----------------------------------------------------------------------- | |
| # Job 2: Generate and deploy static files to vserver | |
| # ----------------------------------------------------------------------- | |
| deploy-static: | |
| name: Deploy static files | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for git lastmod in sitemap | |
| - name: Install Python dependencies | |
| run: pip install pyyaml | |
| - name: Generate sitemap.xml, llms.txt, llms-full.txt | |
| run: python3 custom-domain/generate.py | |
| - name: Validate sitemap.xml | |
| run: python3 -c "import xml.etree.ElementTree as ET; ET.parse('custom-domain/output/sitemap.xml'); print('sitemap.xml is valid XML')" | |
| - name: Copy static files to output | |
| run: cp custom-domain/robots.txt custom-domain/sitemap.xsl custom-domain/output/ | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy to vserver | |
| run: "rsync -avz --delete . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:" | |
| working-directory: custom-domain/output |