Skip to content

Commit 25b085c

Browse files
chore: setup changesets and GitHub Actions publishing (#1)
* chore: setup changesets and GitHub Actions publishing * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix main in package.json * fix access --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 397d8d4 commit 25b085c

16 files changed

Lines changed: 864 additions & 103 deletions

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/clean-clowns-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ohcnetwork/leaderboard-github-plugin": minor
3+
---
4+
5+
initial version

.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/publish.yaml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
1-
name: Publish package to GitHub Packages
1+
name: Release
22

33
on:
44
push:
55
branches:
66
- main
77

8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
810
jobs:
9-
build:
11+
release:
12+
name: Release
1013
runs-on: ubuntu-latest
11-
1214
permissions:
13-
contents: read
15+
contents: write
1416
packages: write
15-
17+
pull-requests: write
1618
steps:
17-
- uses: actions/checkout@v4
19+
- name: Checkout Repo
20+
uses: actions/checkout@v6
1821

19-
- uses: pnpm/action-setup@v4
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
2024
with:
2125
version: 10
2226

23-
- uses: actions/setup-node@v4
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v6
2429
with:
2530
node-version: 22
26-
registry-url: https://npm.pkg.github.com
31+
cache: "pnpm"
2732

28-
- name: Configure npm auth for GitHub Packages
29-
run: |
30-
echo "@ohcnetwork:registry=https://npm.pkg.github.com/" >> ~/.npmrc
31-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
32-
echo "always-auth=true" >> ~/.npmrc
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Install Dependencies
34+
run: pnpm install --frozen-lockfile
3535

36-
- run: pnpm install --frozen-lockfile
36+
- name: Build Package
37+
run: pnpm build
3738

38-
- run: pnpm publish
39+
- name: Create Release Pull Request or Publish to GitHub Packages
40+
id: changesets
41+
uses: changesets/action@v1
42+
with:
43+
version: pnpm changeset version
44+
publish: pnpm changeset publish
45+
commit: "chore: version packages"
46+
title: "chore: version packages"
3947
env:
40-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,38 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
1+
# Dependencies
2+
node_modules/
23

3-
# .env
4-
.env
5-
.env.*
6-
!.env.example
7-
8-
# dependencies
9-
/node_modules
10-
/.yarn
11-
/.pnp
12-
.pnp.js
13-
bun.lockb
14-
package-lock.json
15-
16-
# testing
17-
/coverage
4+
# Build output
5+
dist/
6+
build/
7+
*.tsbuildinfo
188

19-
# next.js
20-
/.next/
21-
/out/
9+
# Environment variables
10+
.env
11+
.env.local
12+
.env.*.local
2213

23-
# production
24-
/build
14+
# IDE
15+
.idea/
16+
.vscode/
17+
*.swp
18+
*.swo
19+
*~
2520

26-
# misc
21+
# OS
2722
.DS_Store
28-
*.pem
23+
Thumbs.db
2924

30-
# debug
25+
# Logs
26+
logs/
27+
*.log
3128
npm-debug.log*
3229
yarn-debug.log*
3330
yarn-error.log*
34-
.pnpm-debug.log*
35-
36-
# local env files
37-
.env*.local
38-
39-
# vercel
40-
.vercel
4131

42-
data-repo
32+
# Testing
33+
coverage/
34+
.nyc_output/
4335

44-
#IDE
45-
.idea
46-
.vscode
47-
48-
# Package Lock
49-
package-lock.json
50-
yarn.lock
51-
52-
# Files placed by data-repo
53-
54-
data/views/
55-
56-
.venv/
57-
58-
# generated files
59-
*.gen.ts
60-
61-
# dist
62-
dist/
36+
# Temporary files
37+
*.tmp
38+
.cache/

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
3+
@ohcnetwork/leaderboard-github-plugin:registry=https://npm.pkg.github.com

README.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @leaderboard/plugin-leaderboard-github-plugin
1+
# @ohcnetwork/leaderboard-github-plugin
22

33
Leaderboard github plugin
44

@@ -9,8 +9,8 @@ Add the plugin to your `config.yaml`:
99
```yaml
1010
leaderboard:
1111
plugins:
12-
leaderboard-github-plugin:
13-
source: "@leaderboard/plugin-leaderboard-github-plugin"
12+
github:
13+
source: "@ohcnetwork/leaderboard-github-plugin"
1414
config:
1515
# TODO: Add your plugin configuration options here
1616
```
@@ -44,6 +44,65 @@ pnpm test
4444
pnpm test:watch
4545
```
4646

47+
## Release Process
48+
49+
This package uses [changesets](https://github.com/changesets/changesets) for version management and automated publishing to GitHub's npm registry.
50+
51+
### For Contributors
52+
53+
When making changes that should be included in the next release:
54+
55+
1. Make your code changes
56+
2. Run `pnpm changeset` to create a changeset file
57+
3. Select the type of change (major, minor, or patch)
58+
4. Describe your changes in the prompt
59+
5. Commit the generated changeset file along with your changes
60+
61+
```bash
62+
pnpm changeset
63+
git add .changeset/
64+
git commit -m "feat: your feature description"
65+
```
66+
67+
### For Maintainers
68+
69+
The release process is automated via GitHub Actions:
70+
71+
1. When PRs with changesets are merged to `main`, a "Version Packages" PR is automatically created/updated
72+
2. Review the Version Packages PR to verify:
73+
- Version bumps are correct
74+
- CHANGELOG entries are accurate
75+
3. Merge the Version Packages PR to automatically publish to GitHub's npm registry
76+
77+
### Manual Publishing (if needed)
78+
79+
If you need to publish manually:
80+
81+
```bash
82+
pnpm build
83+
pnpm release
84+
```
85+
86+
Note: You'll need to be authenticated with GitHub's npm registry and have the appropriate permissions.
87+
88+
### Installing from GitHub Packages
89+
90+
To install this package from GitHub's npm registry:
91+
92+
1. Create or update your `.npmrc` file:
93+
94+
```
95+
@ohcnetwork/leaderboard-github-plugin:registry=https://npm.pkg.github.com
96+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
97+
```
98+
99+
2. Install the package:
100+
101+
```bash
102+
npm install @ohcnetwork/leaderboard-github-plugin
103+
```
104+
105+
47106
## License
48107

49108
MIT

package.json

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
{
22
"name": "@ohcnetwork/leaderboard-github-plugin",
3-
"version": "0.1.0",
3+
"version": "0.0.0",
4+
"private": false,
45
"description": "Leaderboard github plugin",
56
"type": "module",
6-
"main": "dist/src/index.js",
7-
"types": "dist/src/index.d.ts",
8-
"publishConfig": {
9-
"registry": "https://npm.pkg.github.com"
10-
},
7+
"main": "dist/index.js",
118
"scripts": {
129
"build": "tsc && esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external",
1310
"test": "vitest run",
14-
"test:watch": "vitest"
11+
"test:watch": "vitest",
12+
"changeset": "changeset",
13+
"version": "changeset version",
14+
"release": "pnpm build && changeset publish"
1515
},
1616
"keywords": [
1717
"leaderboard",
1818
"plugin"
1919
],
20-
"repository": {
21-
"type": "git",
22-
"url": "https://github.com/ohcnetwork/leaderboard-github-plugin.git"
23-
},
2420
"dependencies": {
2521
"@ohcnetwork/leaderboard-api": "^0.1.0",
2622
"date-fns": "^4.1.0",
27-
"eslint": "^9.39.1",
2823
"octokit": "^5.0.5",
29-
"tsx": "^4.20.6",
3024
"zod": "^4.1.12"
3125
},
3226
"devDependencies": {
27+
"@changesets/cli": "^2.29.8",
3328
"@types/node": "^20.19.27",
3429
"esbuild": "^0.27.2",
30+
"eslint": "^9.39.2",
31+
"tsx": "^4.21.0",
3532
"typescript": "^5.7.3",
3633
"vitest": "^4.0.16"
3734
},
3835
"author": "Open Healthcare Network",
39-
"license": "MIT"
36+
"license": "MIT",
37+
"repository": {
38+
"type": "git",
39+
"url": "git+https://github.com/ohcnetwork/leaderboard-github-plugin.git"
40+
},
41+
"publishConfig": {
42+
"registry": "https://npm.pkg.github.com",
43+
"access": "public"
44+
}
4045
}

0 commit comments

Comments
 (0)