ci: release target-run #33
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Check, build & test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for changeset | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| if ! git diff --name-only origin/main...HEAD | grep -qE '^\.changeset/.+\.md$'; then | |
| echo "No changeset file found in this PR." | |
| echo "Run 'pnpm changeset' to create one before merging." | |
| exit 1 | |
| fi | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint commit messages | |
| if: github.event_name == 'pull_request' | |
| run: pnpm exec commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
| - name: Lint & format (biome check) | |
| run: pnpm check | |
| - name: Knip | |
| run: pnpm knip | |
| - name: Type-check & build | |
| run: pnpm build | |
| - name: Test | |
| run: pnpm test | |
| release: | |
| name: Release | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| HUSKY: '0' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Authenticate with npm registry | |
| run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create release PR or publish | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm release | |
| title: "ci: release target-run" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |