Docs: QUERY is a supported HTTP method in Marko Run #831
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: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Check formatting | |
| run: pnpm exec prettier . --check | |
| # Ahead of the build because these are pure unit tests and take a second. | |
| - name: Test | |
| run: pnpm test | |
| # The docs pages under src/routes/docs/_compiled-docs are generated by the | |
| # build and are not committed, so type-checking before it would silently | |
| # skip every page compiled from markdown. | |
| - name: Build site | |
| run: pnpm run build | |
| - name: Type check | |
| run: pnpm run type-check | |
| release: | |
| runs-on: ubuntu-latest | |
| # Without this the two jobs race, and a lint, formatting or type-check | |
| # failure still deploys to markojs.com. | |
| needs: check | |
| if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}" | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # The gh-pages push below authenticates with an explicit token URL, and | |
| # the fetch is a public read, so the checkout credential is not needed. | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build site | |
| run: pnpm run build | |
| env: | |
| REPO_GITHUB_API_TOKEN: ${{ secrets.REPO_GITHUB_API_TOKEN }} | |
| # Deploy to the gh-pages branch root while preserving the previews/ directory so | |
| # live PR previews survive production deploys (see preview.yml / preview-cleanup.yml). | |
| - name: Deploy to gh-pages (preserving PR previews) | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git fetch origin gh-pages | |
| git worktree add /tmp/gh-pages-deploy gh-pages | |
| # Wipe everything except the previews/ subdirectory and git internals. | |
| find /tmp/gh-pages-deploy -mindepth 1 -maxdepth 1 \ | |
| ! -name '.git' ! -name 'previews' \ | |
| -exec rm -rf {} + | |
| # Copy the freshly-built site in (previews/ is untouched). The custom-domain | |
| # CNAME ships in public/CNAME, so it lands here via the build. | |
| cp -r dist/public/. /tmp/gh-pages-deploy/ | |
| touch /tmp/gh-pages-deploy/.nojekyll | |
| cd /tmp/gh-pages-deploy | |
| git add -A | |
| git commit -m "deploy: main @ ${GITHUB_SHA}" || echo "No changes to deploy." | |
| # Retry on non-fast-forward in case a concurrent preview deploy or cleanup | |
| # writes to gh-pages first. Our commit only touches root files, so replaying | |
| # it onto the latest previews/ changes rebases cleanly. | |
| pushed=false | |
| for attempt in 1 2 3; do | |
| if git push "https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages; then | |
| pushed=true | |
| break | |
| fi | |
| echo "Push rejected, refreshing gh-pages (attempt ${attempt})." | |
| git fetch origin gh-pages | |
| git rebase FETCH_HEAD | |
| done | |
| $pushed || { echo "Failed to push after 3 attempts."; exit 1; } | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |