diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46153a4..b1669e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,78 +9,50 @@ on: - main concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: contents: read jobs: - lint: + ci: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v5 + - name: Checkout + uses: actions/checkout@v5 with: - fetch-depth: 1 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v6 - with: - node-version: 24 - - name: Get pnpm store directory - id: pnpm-cache - run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - run: pnpm install --frozen-lockfile - - run: pnpm run lint + persist-credentials: false - typecheck: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v6 - with: - node-version: 24 - - name: Get pnpm store directory - id: pnpm-cache - run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - run: pnpm install --frozen-lockfile - - run: pnpm run test:types + - name: Setup pnpm + uses: pnpm/action-setup@v4 - test: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 1 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v6 + - name: Setup Node.js + uses: actions/setup-node@v6 with: node-version: 24 + - name: Get pnpm store directory id: pnpm-cache run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 + + - name: Cache pnpm dependencies + uses: actions/cache@v4 with: path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - run: pnpm install --frozen-lockfile - - run: pnpm run test + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm run lint + + - name: Typecheck + run: pnpm run test:types + + - name: Test + run: pnpm run test diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6040a5e..1740cb9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,37 +1,56 @@ -name: Deploy +name: Deploy Docs on: push: branches: - main + paths: + - docs/** + - automd.config.ts + - package.json + - eslint.config.mjs concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: deploy: + name: Deploy Docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - name: Checkout + uses: actions/checkout@v5 with: - fetch-depth: 0 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v6 + persist-credentials: false + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v6 with: node-version: 24 + - name: Get pnpm store directory id: pnpm-cache run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 + + - name: Cache pnpm dependencies + uses: actions/cache@v4 with: path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - run: pnpm install --frozen-lockfile - - run: pnpm run docs:build + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build docs + run: pnpm run docs:build - name: Deploy to Cloudflare run: cd docs && npx wrangler deploy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4164cf0..92cb8a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,52 @@ -name: Release +name: Release + Publish on: push: tags: - 'v*' -permissions: - id-token: write - contents: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: release: + name: Release runs-on: ubuntu-latest + + permissions: + id-token: write + contents: write + steps: - - uses: actions/checkout@v5 + - name: Checkout + uses: actions/checkout@v5 with: - fetch-depth: 0 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v6 + fetch-depth: 0 # Required for fetching tags and generating release notes + persist-credentials: true + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v6 with: node-version: 24 registry-url: https://registry.npmjs.org/ cache: pnpm - - name: Publish changelog + - name: Generate changelog and create GitHub release run: npx changelogithub env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: pnpm install - - run: pnpm run build + - name: Install dependencies + run: pnpm install --frozen-lockfile - - name: Copy READMEs for npm packages - run: | - cp README.md packages/toon/README.md - echo "✓ Copied root README to @toon-format/toon" - echo "✓ CLI package uses its own README" + - name: Build packages + run: pnpm run build - - name: Publish to npm + - name: Publish packages to npm run: npm install -g npm@latest && pnpm -r publish --access public --no-git-checks env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}