Skip to content

Commit fba4368

Browse files
Jonathan D.A. Jewellclaude
andcommitted
feat(publish): add registry publishing workflows
Add GitHub Actions workflows for publishing to package registries: - publish-crates.yml: Publish Rust crate to crates.io - publish-pypi.yml: Publish Python package to PyPI (trusted publishing) - publish-npm.yml: Publish JavaScript/TypeScript to npm - publish-jsr.yml: Publish Deno package to JSR - release.yml: Combined release workflow triggered by version tags Also: - Bump Python version to 0.8.0 - Bump JavaScript version to 0.8.0 - Add Ada build artifacts to .gitignore - Remove committed Ada build artifacts Secrets required: - CRATES_IO_TOKEN: crates.io API token - NPM_TOKEN: npm access token - JSR_TOKEN: Deno Deploy token (for JSR) - PyPI: Uses trusted publishing (OIDC) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2b4ebb6 commit fba4368

31 files changed

Lines changed: 498 additions & 1037 deletions
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# SPDX-FileCopyrightText: 2025 Hyperpolymath
3+
name: Publish to crates.io
4+
5+
on:
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: 'Dry run (do not actually publish)'
12+
required: false
13+
default: 'true'
14+
type: boolean
15+
16+
permissions: read-all
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
21+
jobs:
22+
publish:
23+
name: Publish Rust crate
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
working-directory: bindings/rust
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
34+
35+
- name: Install Rust toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
38+
- name: Cache cargo registry
39+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
40+
with:
41+
path: |
42+
~/.cargo/registry
43+
~/.cargo/git
44+
target
45+
key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }}
46+
47+
- name: Verify package
48+
run: cargo package --list
49+
50+
- name: Check package can be published
51+
run: cargo publish --dry-run
52+
53+
- name: Publish to crates.io
54+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
55+
run: cargo publish
56+
env:
57+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
58+
59+
- name: Summary
60+
run: |
61+
echo "## Rust Package Published" >> $GITHUB_STEP_SUMMARY
62+
echo "" >> $GITHUB_STEP_SUMMARY
63+
echo "- **Package**: proven" >> $GITHUB_STEP_SUMMARY
64+
echo "- **Version**: $(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_STEP_SUMMARY
65+
echo "- **Registry**: [crates.io](https://crates.io/crates/proven)" >> $GITHUB_STEP_SUMMARY

.github/workflows/publish-jsr.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# SPDX-FileCopyrightText: 2025 Hyperpolymath
3+
name: Publish to JSR
4+
5+
on:
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: 'Dry run (do not actually publish)'
12+
required: false
13+
default: 'true'
14+
type: boolean
15+
16+
permissions: read-all
17+
18+
jobs:
19+
publish:
20+
name: Publish Deno package to JSR
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
id-token: write # Required for JSR provenance
25+
defaults:
26+
run:
27+
working-directory: bindings/deno
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
32+
33+
- name: Setup Deno
34+
uses: denoland/setup-deno@5fae568d37c3b73449009674875529a984555dd1 # v2
35+
with:
36+
deno-version: v2.x
37+
38+
- name: Verify package
39+
run: deno publish --dry-run
40+
41+
- name: Run tests
42+
run: deno test --allow-read
43+
44+
- name: Lint
45+
run: deno lint
46+
47+
- name: Format check
48+
run: deno fmt --check
49+
50+
- name: Publish to JSR
51+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
52+
run: deno publish
53+
env:
54+
DENO_DEPLOY_TOKEN: ${{ secrets.JSR_TOKEN }}
55+
56+
- name: Summary
57+
run: |
58+
echo "## Deno Package Published" >> $GITHUB_STEP_SUMMARY
59+
echo "" >> $GITHUB_STEP_SUMMARY
60+
echo "- **Package**: @hyperpolymath/proven" >> $GITHUB_STEP_SUMMARY
61+
echo "- **Version**: $(deno eval 'const c = JSON.parse(Deno.readTextFileSync("deno.json")); console.log(c.version)')" >> $GITHUB_STEP_SUMMARY
62+
echo "- **Registry**: [JSR](https://jsr.io/@hyperpolymath/proven)" >> $GITHUB_STEP_SUMMARY

.github/workflows/publish-npm.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# SPDX-FileCopyrightText: 2025 Hyperpolymath
3+
name: Publish to npm
4+
5+
on:
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: 'Dry run (do not actually publish)'
12+
required: false
13+
default: 'true'
14+
type: boolean
15+
package:
16+
description: 'Package to publish'
17+
required: false
18+
default: 'all'
19+
type: choice
20+
options:
21+
- all
22+
- javascript
23+
- typescript
24+
25+
permissions: read-all
26+
27+
jobs:
28+
publish-javascript:
29+
name: Publish JavaScript package
30+
runs-on: ubuntu-latest
31+
if: inputs.package == 'all' || inputs.package == 'javascript' || github.event_name == 'release'
32+
permissions:
33+
contents: read
34+
id-token: write
35+
defaults:
36+
run:
37+
working-directory: bindings/javascript
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
45+
with:
46+
node-version: '20'
47+
registry-url: 'https://registry.npmjs.org'
48+
49+
- name: Verify package
50+
run: npm pack --dry-run
51+
52+
- name: Publish to npm
53+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
54+
run: npm publish --access public --provenance
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
58+
publish-typescript:
59+
name: Publish TypeScript package
60+
runs-on: ubuntu-latest
61+
if: inputs.package == 'all' || inputs.package == 'typescript' || github.event_name == 'release'
62+
permissions:
63+
contents: read
64+
id-token: write
65+
defaults:
66+
run:
67+
working-directory: bindings/typescript
68+
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
72+
73+
- name: Setup Node.js
74+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
75+
with:
76+
node-version: '20'
77+
registry-url: 'https://registry.npmjs.org'
78+
79+
- name: Install dependencies
80+
run: npm install
81+
82+
- name: Build TypeScript
83+
run: npm run build
84+
85+
- name: Verify package
86+
run: npm pack --dry-run
87+
88+
- name: Publish to npm
89+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
90+
run: npm publish --access public --provenance
91+
env:
92+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
93+
94+
summary:
95+
name: Publish summary
96+
needs: [publish-javascript, publish-typescript]
97+
runs-on: ubuntu-latest
98+
if: always()
99+
100+
steps:
101+
- name: Summary
102+
run: |
103+
echo "## npm Packages Published" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
echo "| Package | Registry |" >> $GITHUB_STEP_SUMMARY
106+
echo "|---------|----------|" >> $GITHUB_STEP_SUMMARY
107+
echo "| @proven/javascript | [npm](https://www.npmjs.com/package/@proven/javascript) |" >> $GITHUB_STEP_SUMMARY
108+
echo "| @proven/typescript | [npm](https://www.npmjs.com/package/@proven/typescript) |" >> $GITHUB_STEP_SUMMARY

.github/workflows/publish-pypi.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# SPDX-FileCopyrightText: 2025 Hyperpolymath
3+
name: Publish to PyPI
4+
5+
on:
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: 'Dry run (do not actually publish)'
12+
required: false
13+
default: 'true'
14+
type: boolean
15+
16+
permissions: read-all
17+
18+
jobs:
19+
build:
20+
name: Build distribution
21+
runs-on: ubuntu-latest
22+
defaults:
23+
run:
24+
working-directory: bindings/python
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
32+
with:
33+
python-version: '3.12'
34+
35+
- name: Install build dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install build twine
39+
40+
- name: Build package
41+
run: python -m build
42+
43+
- name: Check distribution
44+
run: twine check dist/*
45+
46+
- name: Upload distribution artifacts
47+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
48+
with:
49+
name: python-dist
50+
path: bindings/python/dist/
51+
52+
publish:
53+
name: Publish to PyPI
54+
needs: build
55+
runs-on: ubuntu-latest
56+
permissions:
57+
id-token: write # Required for trusted publishing
58+
environment:
59+
name: pypi
60+
url: https://pypi.org/project/proven/
61+
62+
steps:
63+
- name: Download distribution artifacts
64+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
65+
with:
66+
name: python-dist
67+
path: dist/
68+
69+
- name: Publish to PyPI
70+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
71+
uses: pypa/gh-action-pypi-publish@release/v1
72+
with:
73+
# Uses trusted publishing - no token needed if configured in PyPI
74+
75+
- name: Summary
76+
run: |
77+
echo "## Python Package Published" >> $GITHUB_STEP_SUMMARY
78+
echo "" >> $GITHUB_STEP_SUMMARY
79+
echo "- **Package**: proven" >> $GITHUB_STEP_SUMMARY
80+
echo "- **Registry**: [PyPI](https://pypi.org/project/proven/)" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)