From 6bf8a18d913c019540aa87053549a1f3cc8e9ce9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 9 Jan 2025 11:31:57 +0100 Subject: [PATCH 1/2] ci: split out lint + release workflows --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++-------- package.json | 1 + 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd35eb00..af4318da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,35 @@ on: - main jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 0 + - run: corepack enable + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 22 + cache: pnpm + + - name: 📦 Install dependencies + run: pnpm install + + - name: 🔠 Lint project + run: pnpm lint + + - name: ✂️ Knip project + run: pnpm test:knip + + # - name: ⚙️ Check package engines + # run: pnpm test:engines + ci: strategy: matrix: os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} - # permissions: - # id-token: write steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: @@ -26,26 +48,43 @@ jobs: node-version: 18 cache: pnpm - run: pnpm install - - run: pnpm lint - run: pnpm test:types - run: pnpm build - - run: pnpm knip - run: pnpm test:dist - run: pnpm test:unit - if: matrix.os != 'windows-latest' uses: codecov/codecov-action@v5 + + release: + runs-on: ubuntu-latest + permissions: + id-token: write + if: github.repository_owner == 'nuxt' + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 0 + - run: corepack enable + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 22 + cache: pnpm + + - name: 📦 Install dependencies + run: pnpm install + + - name: 🛠 Build project + run: pnpm build + - name: 📦 release pkg.pr.new - if: github.event_name != 'push' && matrix.os != 'windows-latest' - run: pnpx pkg-pr-new publish --compact --template './playground' + if: github.event_name != 'push' + run: pnpm pkg-pr-new publish --compact --template './playground' + - name: 📦 release nuxi-nightly - if: | - github.event_name == 'push' && - matrix.os != 'windows-latest' && - !contains(github.event.head_commit.message, '[skip-release]') && - !contains(github.event.head_commit.message, 'docs') + if: github.event_name == 'push' run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc && pnpm changelogen --canary nightly --publish env: NPM_TOKEN: ${{secrets.NPM_TOKEN}} - NPM_CONFIG_PROVENANCE: false + NPM_CONFIG_PROVENANCE: true diff --git a/package.json b/package.json index 5ae1751d3..95199f9b1 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "test": "pnpm lint && pnpm test:types && pnpm build && pnpm test:dist", "test:dist": "node ./bin/nuxi.mjs info ./playground", "test:types": "tsc --noEmit", + "test:knip": "knip", "test:unit": "vitest --coverage" }, "devDependencies": { From b94604eb564d3dbedd7cb81a4d85af49f98389f0 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 9 Jan 2025 11:33:25 +0100 Subject: [PATCH 2/2] chore: lint --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af4318da7..f58bdaa55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: - name: 📦 Install dependencies run: pnpm install - + - name: 🛠 Build project run: pnpm build