Skip to content

Commit bb52e2f

Browse files
committed
chore: add SponsorKit graph automation
1 parent 69d87bf commit bb52e2f

7 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { defineConfig } from 'sponsorkit'
2+
3+
const atlasCloud = {
4+
name: 'direct',
5+
async fetchSponsors() {
6+
return [
7+
{
8+
sponsor: {
9+
type: 'Organization',
10+
login: 'atlas-cloud',
11+
name: 'Atlas Cloud',
12+
avatarUrl: 'https://github.com/AtlasCloudAI.png?size=180',
13+
websiteUrl: 'https://www.atlascloud.ai/',
14+
linkUrl: 'https://www.atlascloud.ai/',
15+
},
16+
monthlyDollars: 150,
17+
provider: 'direct',
18+
},
19+
]
20+
},
21+
}
22+
23+
const providers = [atlasCloud]
24+
25+
if (process.env.SPONSORKIT_GITHUB_TOKEN) providers.push('github')
26+
if (process.env.SPONSORKIT_PATREON_TOKEN) providers.push('patreon')
27+
28+
export default defineConfig({
29+
github: {
30+
login: 'mayocream',
31+
type: 'user',
32+
},
33+
providers,
34+
outputDir: '.',
35+
formats: ['svg'],
36+
width: 800,
37+
})

.github/sponsorkit/sponsors.svg

Lines changed: 26 additions & 0 deletions
Loading

.github/workflows/sponsors.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Sponsors
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '17 3 * * *'
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: sponsors
13+
cancel-in-progress: true
14+
15+
jobs:
16+
update:
17+
name: Update sponsor graph
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
env:
21+
SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORKIT_GITHUB_TOKEN }}
22+
SPONSORKIT_PATREON_TOKEN: ${{ secrets.SPONSORKIT_PATREON_TOKEN }}
23+
steps:
24+
- uses: actions/checkout@v7
25+
- uses: oven-sh/setup-bun@v2
26+
27+
- name: Validate provider tokens
28+
run: |
29+
test -n "$SPONSORKIT_GITHUB_TOKEN" || { echo "SPONSORKIT_GITHUB_TOKEN is not configured"; exit 1; }
30+
test -n "$SPONSORKIT_PATREON_TOKEN" || { echo "SPONSORKIT_PATREON_TOKEN is not configured"; exit 1; }
31+
32+
- run: bun install --frozen-lockfile
33+
- run: bun run sponsors
34+
35+
- name: Commit updated graph
36+
run: |
37+
git add .github/sponsorkit/sponsors.svg
38+
git diff --cached --quiet && exit 0
39+
git config user.name github-actions[bot]
40+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
41+
git commit -m "chore: update sponsors [skip ci]"
42+
git push

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ site/
5353

5454
# integration-tests shared runtime cache
5555
.cache/
56+
57+
# SponsorKit runtime cache (the generated SVG is tracked)
58+
.cache.json

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ If Koharu is useful in your workflow, consider sponsoring the project.
216216
- [GitHub Sponsors](https://github.com/sponsors/mayocream)
217217
- [Patreon](https://www.patreon.com/mayocream)
218218

219+
![sponsors](./.github/sponsorkit/sponsors.svg)
220+
219221
## Contributors ❤️
220222

221223
Thanks to all the contributors who have helped make Koharu better!

bun.lock

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"test:ui": "bun run --filter ui test",
1414
"typecheck:desktop": "tsc --project tests/integration-tests/tsconfig.json",
1515
"typecheck:integration": "bun run typecheck:desktop",
16+
"sponsors": "cd .github/sponsorkit && sponsorkit --force",
1617
"format": "oxfmt ui tests package.json .oxfmtrc.json .vscode",
1718
"format:check": "oxfmt --check ui tests package.json .oxfmtrc.json .vscode"
1819
},
@@ -24,6 +25,7 @@
2425
"nodemon": "^3.1.14",
2526
"npm-run-all2": "^8.0.4",
2627
"oxfmt": "^0.56.0",
28+
"sponsorkit": "^17.1.1",
2729
"typescript": "^6.0.3"
2830
}
2931
}

0 commit comments

Comments
 (0)