Skip to content

Commit

Permalink
ci: simplifies & commitlint (#40)
Browse files Browse the repository at this point in the history
* ci: simplifies

* ci: only publish-next on push and main

* docs: remove packageManager on playgrounds

* ci: commitlint

* ci: publish with NPM_CONFIG_PROVENANCE
  • Loading branch information
unnoq authored Nov 30, 2024
1 parent bd66bad commit 255eb59
Show file tree
Hide file tree
Showing 11 changed files with 560 additions and 95 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- run: pnpm i

- run: pnpm run lint

- run: pnpm run type:check

- run: pnpm run test

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- run: pnpm i

- run: pnpm run lint

- run: pnpm run type:check

- run: pnpm run test

publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [lint, test]
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm i

- name: Changeset version or publish on @latest
uses: changesets/action@v1
with:
commit: 'chore(release): version packages'
title: 'chore(release): version packages'
version: pnpm run changeset:version
publish: pnpm run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true

publish-next:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm i

- run: pnpm run changeset:version --snapshot next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm run changeset:publish --tag next
env:
NPM_CONFIG_PROVENANCE: true

publish-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- run: pnpm i

- run: pnpm build:packages

- run: pnpm publish:packages:commit
24 changes: 0 additions & 24 deletions .github/workflows/code-quality.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/release-next.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/release-stable.yaml

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ['@commitlint/config-conventional'] }
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
"knip:fix": "pnpm run knip --fix --allow-remove-files",
"changeset:version": "changeset version",
"changeset:publish": "pnpm run build:packages && pnpm changeset publish",
"publish:packages:commit": "pnpm dlx pkg-pr-new publish './packages/*' --pnpm --compact --template './playgrounds/*'",
"prepare": "simple-git-hooks"
},
"devDependencies": {
"@antfu/eslint-config": "^3.9.2",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.9",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@eslint-react/eslint-plugin": "^1.16.2",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
Expand All @@ -47,7 +50,8 @@
"vitest": "^2.1.3"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
"pre-commit": "pnpm lint-staged",
"commit-msg": "pnpm commitlint -e"
},
"lint-staged": {
"*": "eslint --no-warn-ignored --max-warnings=0 --fix"
Expand Down
1 change: 0 additions & 1 deletion playgrounds/contract-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "orpc-contract-openapi-playground",
"type": "module",
"version": "0.0.0",
"packageManager": "pnpm@8.15.6",
"description": "oRPC Contract OpenAPI Playground",
"author": "unnoq",
"license": "ISC",
Expand Down
1 change: 0 additions & 1 deletion playgrounds/expressjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "orpc-expresjs-playground",
"type": "module",
"version": "0.0.0",
"packageManager": "pnpm@8.15.6",
"description": "oRPC ExpressJS Playground",
"author": "unnoq",
"license": "ISC",
Expand Down
1 change: 0 additions & 1 deletion playgrounds/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "orpc-nextjs-playground",
"version": "0.1.0",
"private": true,
"packageManager": "pnpm@8.15.6",
"description": "oRPC NextJS Playground",
"author": "unnoq",
"keywords": [
Expand Down
1 change: 0 additions & 1 deletion playgrounds/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "orpc-openapi-playground",
"type": "module",
"version": "0.0.0",
"packageManager": "pnpm@8.15.6",
"description": "oRPC OpenAPI Playground",
"author": "unnoq",
"license": "ISC",
Expand Down
Loading

0 comments on commit 255eb59

Please sign in to comment.