Skip to content

Commit 00d11d4

Browse files
authored
chore(ci): add workflow for publishing (#5)
* chore(editorconfig): add base formatting rules * chore(gitignore): add comprehensive ignore rules - Ignore dependencies: node_modules, .pnp, .env files - Ignore debug artifacts: logs, traces - Ignore build outputs: dist, build, out, cache, tmp, tsbuildinfo - Ignore IDE configs: .idea, .vscode, .fleet, Sublime files - Ignore testing outputs: coverage, test-results, snapshots - Ignore framework/platform outputs: .next, .nuxt, .vercel, .turbo - Ignore CI/CD & deployment secrets: keys, certs, db files, .venv - Ignore vendor/generated content: contentlayer, react-email, generated types - Ignore monorepo workspace outputs: packages/* and apps/* build artifacts - Ignore OS & misc files: Thumbs.db, .DS_Store, swap, bak, tmp * add secure release pipeline with changesets * restrict published files via package.json files whitelist * add readme.md file
1 parent 6c4f3a1 commit 00d11d4

6 files changed

Lines changed: 768 additions & 0 deletions

File tree

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema" : "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog" : "@changesets/cli/changelog",
4+
"commit" : false,
5+
"fixed" : [],
6+
"linked" : [],
7+
"access" : "public",
8+
"baseBranch" : "main",
9+
"updateInternalDependencies" : "patch",
10+
"ignore" : []
11+
}

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Workflow name
2+
name: Publish presets
3+
4+
# Workflow conditions
5+
on:
6+
# Allow manual trigger from GitHub Actions UI
7+
workflow_dispatch:
8+
# Run on pushes to tags
9+
push:
10+
tags:
11+
- 'v*.*.*'
12+
13+
# Grant write permissions to all scopes
14+
permissions: write-all
15+
16+
# Ensure only one workflow runs per ref at a time
17+
concurrency: ${{ github.workflow }}-${{ github.ref }}
18+
19+
# Workflow jobs
20+
jobs:
21+
# Job (Publish)
22+
publish:
23+
# Job name shown in GitHub Actions UI
24+
name: Publish package (release)
25+
# Runner environment (Ubuntu)
26+
runs-on: ubuntu-latest
27+
# Job steps
28+
steps:
29+
# Checkout the repository code from main branch
30+
- uses: actions/checkout@v6
31+
with:
32+
ref: main
33+
# Set up Node.js environment using version from .nvmrc
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version-file: .nvmrc
38+
# Install a specific version of corepack globally (hardcoded for stability)
39+
- name: 'Install corepack@0.31'
40+
shell: bash
41+
run: |
42+
npm install -g corepack@0.31
43+
echo "corepack version after: $(corepack --version)"
44+
# Enable corepack to manage pnpm
45+
- name: Enable Corepack
46+
run: corepack enable
47+
# Configure npm authentication using secret token
48+
- name: Configure npm auth
49+
run: npm config set //registry.npmjs.org/:_authToken="${NPM_TOKEN}"
50+
env:
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52+
# Install project dependencies with pnpm
53+
- name: Install dependencies
54+
run: pnpm install --frozen-lockfile
55+
# Use changesets to either create a release PR or publish packages
56+
- name: Create release pull request or publish
57+
id: changesets
58+
uses: changesets/action@v1.4.10
59+
with:
60+
publish: pnpm run release
61+
version: pnpm run version
62+
title: "chore(changesets): update versions of packages for release"
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.12.0

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
},
1919

2020
"scripts" : {
21+
"version" : "changeset version",
22+
"release" : "changeset publish",
2123
"clean" : "rimraf node_modules dist .turbo"
2224
},
2325

@@ -26,6 +28,7 @@
2628
"types" : "./dist/index.d.ts",
2729

2830
"devDependencies" : {
31+
"@changesets/cli" : "^2.29.8",
2932
"@eslint/js" : "^10.0.1",
3033
"@next/eslint-plugin-next" : "^16.2.1",
3134
"eslint" : "^10.1.0",
@@ -48,6 +51,7 @@
4851
"./next-config" : "./src/next.json",
4952
"./react-config" : "./src/react.json"
5053
},
54+
"files" : ["src", "readme.md", "license.md"],
5155

5256
"publishConfig" : {
5357
"access" : "public"

0 commit comments

Comments
 (0)