Skip to content

Commit 28ae0b1

Browse files
author
RouterBase Contributors
committed
Add trusted publishing workflows
1 parent 197d7f8 commit 28ae0b1

5 files changed

Lines changed: 179 additions & 0 deletions

File tree

.github/workflows/publish-ghcr.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish GHCR
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
packages: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: docker/login-action@v3
16+
with:
17+
registry: ghcr.io
18+
username: ${{ github.actor }}
19+
password: ${{ secrets.GITHUB_TOKEN }}
20+
- uses: docker/metadata-action@v5
21+
id: meta
22+
with:
23+
images: ghcr.io/routerbase/routerbase-prompt-runner
24+
tags: |
25+
type=raw,value=latest
26+
type=sha
27+
- uses: docker/build-push-action@v6
28+
with:
29+
context: .
30+
file: examples/docker/Dockerfile
31+
push: true
32+
tags: ${{ steps.meta.outputs.tags }}
33+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/publish-jsr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish JSR
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: packages/jsr-routerbase
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: "20"
21+
- run: npx jsr publish

.github/workflows/publish-pypi.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: packages/python-routerbase
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
- run: python -m pip install --upgrade build
22+
- run: python -m build
23+
- uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
packages-dir: packages/python-routerbase/dist

docs/batch-plan.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ Content goals:
2828
- Model listing helper.
2929
- Deno and modern TypeScript usage examples.
3030

31+
Status:
32+
33+
- Local dry run passes.
34+
- Manual GitHub Actions workflow added: `.github/workflows/publish-jsr.yml`.
35+
3136
## Batch 3 - PyPI
3237

3338
Publish the Python package from `packages/python-routerbase`.
@@ -42,6 +47,12 @@ Content goals:
4247
- CLI entry point.
4348
- Project URLs that point to RouterBase docs and GitHub.
4449

50+
Status:
51+
52+
- Wheel and sdist build locally.
53+
- `twine check` passes.
54+
- Manual GitHub Actions workflow added: `.github/workflows/publish-pypi.yml`.
55+
4556
## Batch 4 - Docker
4657

4758
Publish a small prompt runner image to Docker Hub or GitHub Container Registry.
@@ -57,6 +68,11 @@ Content goals:
5768
- One command prompt execution.
5869
- Link back to RouterBase docs.
5970

71+
Status:
72+
73+
- Dockerfile added.
74+
- Manual GitHub Actions workflow added: `.github/workflows/publish-ghcr.yml`.
75+
6076
## Batch 5 - Language SDKs
6177

6278
Add one SDK at a time only when it has real tests and examples:

docs/trusted-publishing.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Trusted Publishing Setup
2+
3+
The repository includes manual workflows for JSR, PyPI, and GitHub Container Registry. They are designed to publish real packages without storing long-lived platform tokens in GitHub secrets.
4+
5+
## JSR
6+
7+
Workflow:
8+
9+
```text
10+
.github/workflows/publish-jsr.yml
11+
```
12+
13+
Package:
14+
15+
```text
16+
packages/jsr-routerbase
17+
```
18+
19+
Before running:
20+
21+
- Create or claim the `@routerbase` scope on JSR.
22+
- Configure trusted publishing for `RouterBase/routerbase-examples`.
23+
- Set the package path to `packages/jsr-routerbase`.
24+
- Run the workflow manually from GitHub Actions.
25+
26+
Local verification:
27+
28+
```bash
29+
cd packages/jsr-routerbase
30+
npx jsr publish --dry-run
31+
```
32+
33+
## PyPI
34+
35+
Workflow:
36+
37+
```text
38+
.github/workflows/publish-pypi.yml
39+
```
40+
41+
Package:
42+
43+
```text
44+
packages/python-routerbase
45+
```
46+
47+
Before running:
48+
49+
- Create the `routerbase-client` project on PyPI through the first trusted publish.
50+
- Configure PyPI trusted publishing for `RouterBase/routerbase-examples`.
51+
- Use workflow name `Publish PyPI`.
52+
- Use package directory `packages/python-routerbase`.
53+
54+
Local verification:
55+
56+
```bash
57+
cd packages/python-routerbase
58+
python -m build
59+
python -m twine check dist/*
60+
```
61+
62+
## GitHub Container Registry
63+
64+
Workflow:
65+
66+
```text
67+
.github/workflows/publish-ghcr.yml
68+
```
69+
70+
Image:
71+
72+
```text
73+
ghcr.io/routerbase/routerbase-prompt-runner
74+
```
75+
76+
Before running:
77+
78+
- Confirm the repository has package write permission.
79+
- Run the workflow manually from GitHub Actions.
80+
- After the first push, make the package public in GitHub Packages if needed.
81+
82+
## Link Policy
83+
84+
Keep links natural and developer-focused. The first README link uses `[RouterBase](https://routerbase.com)`, and package metadata points to the RouterBase homepage.

0 commit comments

Comments
 (0)