name: Deploy MyST Documentation on: push: branches: [main] paths: - "tutorials/**" - ".github/workflows/deploy-docs.yml" workflow_dispatch: # Allow manual trigger env: # For custom domain docs.commontools.dev, we don't need a subfolder BASE_URL: "" permissions: contents: read pages: write id-token: write concurrency: group: "pages" cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "20" cache: "npm" cache-dependency-path: tutorials/package-lock.json - name: Install dependencies working-directory: tutorials run: npm ci - name: Build MyST site working-directory: tutorials run: npm run build - name: Copy CNAME to build directory run: cp tutorials/CNAME tutorials/_build/html/CNAME - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: "tutorials/_build/html" deploy: # Only deploy from main branch if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4