Skip to content

Commit

Permalink
Merge pull request #2 from nrdobie/setup-publish
Browse files Browse the repository at this point in the history
ci: enabling auto-publish with semantic release
  • Loading branch information
nrdobie authored Feb 23, 2024
2 parents 920f64d + bdc4c9e commit ad5d750
Show file tree
Hide file tree
Showing 5 changed files with 1,422 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: pr
concurrency:
group: publish-${{ github.github.base_ref }}
group: pr-${{ github.github.base_ref }}
cancel-in-progress: true
on:
pull_request:
paths:
paths-ignore:
- '**/*.md'
jobs:
test-and-publish:
Expand Down Expand Up @@ -41,6 +41,10 @@ jobs:
name: Setup Node.js
with:
node-version: 20
- name: Run lint
run: pnpm run ci:lint
- name: Build Prisma Test DB
run: pnpm exec prisma db push
- name: Run tests
run: pnpm test --coverage
run: pnpm run ci:test

58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: publish
concurrency:
group: publish-${{ github.github.base_ref }}
cancel-in-progress: true
on:
push:
branches:
- main
- next
- beta
- alpha
jobs:
test-and-publish:
name: Test and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
depth: 0
- uses: pnpm/action-setup@v2
name: Install PNPM
with:
version: 8
run_install: false
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get PNPM store directory
id: pnpm-store
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/cache@v3
name: Setup PNPM cache
with:
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 20
- name: Run lint
run: pnpm run ci:lint
- name: Build Prisma Test DB
run: pnpm exec prisma db push
- name: Run tests
run: pnpm run ci:test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm exec semantic-release

10 changes: 10 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"branches": ["main", "next", { "name": "beta", "prerelease": true }, { "name": "alpha", "prerelease": true }],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"type": "module",
"scripts": {
"build": "vite build && publint --strict",
"test": "vitest"
"test": "vitest",
"ci:test": "vitest --coverage",
"ci:lint": "eslint --max-warnings 0 ./src"
},
"exports": {
".": {
Expand Down Expand Up @@ -36,6 +38,7 @@
"devDependencies": {
"@eslint/js": "^8.56.0",
"@prisma/client": "^5.10.2",
"@semantic-release/git": "^10.0.1",
"@tanstack/config": "^0.5.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^20.11.20",
Expand All @@ -46,6 +49,7 @@
"prettier": "^3.2.5",
"prisma": "^5.10.2",
"publint": "^0.2.7",
"semantic-release": "^23.0.2",
"tmp": "^0.2.1",
"typescript": "^5.3.3",
"typescript-eslint": "^7.0.2",
Expand Down
Loading

0 comments on commit ad5d750

Please sign in to comment.