update publish workflow to include docs generation and improve commit… #5
Workflow file for this run
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: Publish Docs | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| - "v[0-9]+.[0-9]+.[0-9]+-beta.*" # beta should be removed once first stable released | |
| jobs: | |
| publish-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout maps-js | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate docs | |
| run: npm run generate-docs | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: maptoolkit/docs | |
| path: docs-repo | |
| token: ${{ secrets.DOCS_REPO_TOKEN }} | |
| - name: Write files | |
| run: | | |
| sed 's|# API Reference|---\ntitle: "API Reference"\nweight: 1\n---\n|g' docs/API.md > docs-repo/docs/content/maps-js/api-reference.md | |
| - name: Commit and push | |
| working-directory: docs-repo | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/content/maps-js/ | |
| git diff --cached --quiet || git commit -m "chore: update maps-js docs (${{ github.ref_name }})" | |
| git push |