Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "oxa-dev/oxa" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@oxa/scripts"]
}
171 changes: 171 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Release

on:
push:
branches: [main]
workflow_dispatch:
inputs:
tag:
description: "Custom tag override (default: per-package tags via changesets)"
type: string
required: false
publish-npm:
description: Publish npm packages (oxa-types, @oxa/core, oxa)
type: boolean
default: true
publish-pypi:
description: Publish Python package (oxa-types)
type: boolean
default: true
publish-crates:
description: Publish Rust package (oxa-types)
type: boolean
default: true
create-release:
description: Create GitHub Release
type: boolean
default: true
dry-run:
description: Dry run (skip actual publishing)
type: boolean
default: false

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
published-packages: ${{ steps.changesets.outputs.publishedPackages }}
types-version: ${{ steps.get-versions.outputs.types-version }}
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
registry-url: "https://registry.npmjs.org"

- uses: astral-sh/setup-uv@v5

- uses: dtolnay/rust-toolchain@stable

- run: pnpm install --frozen-lockfile

- name: Create Release PR or Publish npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm run version
# Use changeset publish to only publish packages that were actually bumped
publish: ${{ (inputs.dry-run == true || inputs.publish-npm == false) && 'echo Skipping npm publish' || 'pnpm build && pnpm changeset publish' }}
createGithubReleases: ${{ inputs.create-release != false }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get published types version
id: get-versions
if: steps.changesets.outputs.published == 'true'
run: |
# Read version after changesets has bumped it
TYPES_VERSION=$(jq -r '.version' packages/oxa-types-ts/package.json)
echo "types-version=$TYPES_VERSION" >> $GITHUB_OUTPUT

publish-pypi:
name: Publish to PyPI
needs: release
if: |
needs.release.outputs.published == 'true' &&
inputs.publish-pypi != false &&
contains(needs.release.outputs.published-packages, 'oxa-types')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5

- name: Build Python package
working-directory: packages/oxa-types-py
run: uv build

- name: Publish to PyPI
if: ${{ inputs.dry-run != true }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: packages/oxa-types-py/dist/
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Dry run - show what would be published
if: ${{ inputs.dry-run == true }}
run: |
echo "Dry run - would publish:"
ls -la packages/oxa-types-py/dist/

publish-crates:
name: Publish to crates.io
needs: release
if: |
needs.release.outputs.published == 'true' &&
inputs.publish-crates != false &&
contains(needs.release.outputs.published-packages, 'oxa-types')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- name: Publish to crates.io
if: ${{ inputs.dry-run != true }}
working-directory: packages/oxa-types-rs
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

- name: Dry run - check package
if: ${{ inputs.dry-run == true }}
working-directory: packages/oxa-types-rs
run: cargo publish --dry-run

create-schema-tag:
name: Create schema tag
needs: [release, publish-pypi, publish-crates]
if: |
always() &&
needs.release.outputs.published == 'true' &&
contains(needs.release.outputs.published-packages, 'oxa-types') &&
(needs.publish-pypi.result == 'success' || needs.publish-pypi.result == 'skipped') &&
(needs.publish-crates.result == 'success' || needs.publish-crates.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create and push schema tag
if: ${{ inputs.dry-run != true }}
run: |
VERSION="${{ needs.release.outputs.types-version }}"
TAG="schema@${VERSION}"

# Check if tag already exists
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping"
else
git tag "$TAG"
git push origin "$TAG"
echo "Created and pushed tag: $TAG"
fi

- name: Dry run - show what tag would be created
if: ${{ inputs.dry-run == true }}
run: |
VERSION="${{ needs.release.outputs.types-version }}"
echo "Dry run - would create tag: schema@${VERSION}"
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,39 @@ pnpm clean

**Note:** This project uses [Turborepo](https://turbo.build/) for build orchestration. Turborepo provides intelligent caching and parallel task execution across the monorepo, significantly speeding up builds and tests.

## Releases

This project uses [Changesets](https://github.com/changesets/changesets) for version management and releases.

### Adding a changeset

When you make changes that should be released, run:

```bash
pnpm changeset
```

This will prompt you to:
1. Select which packages are affected
2. Choose the bump type (patch, minor, major)
3. Write a summary of the changes

Commit the generated changeset file with your PR.

### Release process

1. When PRs with changesets are merged to `main`, a "Version Packages" PR is automatically created/updated
2. Merging the "Version Packages" PR triggers the release workflow
3. Packages are published to:
- **npm**: `oxa-types`, `@oxa/core`, `oxa`
- **PyPI**: `oxa-types`
- **crates.io**: `oxa-types`

### Version synchronization

- `oxa-types` (TypeScript), `oxa-types` (Python), and `oxa-types` (Rust) stay in sync
- `@oxa/core` and `oxa` can version independently

## Documentation

The documentation uses [MyST](https://mystmd.org) and requires the automated codegen tool to run. To start the documentation use `npm install -g mystmd` and run `myst start` in the `docs/` folder. The online documentation is hosted using Curvenote under https://oxa.dev
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "oxa-monorepo",
"version": "0.1.0",
"private": true,
"type": "module",
"engines": {
Expand All @@ -18,9 +17,15 @@
"lint:fix": "turbo lint:fix",
"build": "turbo build",
"test": "turbo test",
"clean": "turbo clean"
"clean": "turbo clean",
"changeset": "changeset",
"version": "changeset version && pnpm codegen all",
"publish:pypi": "cd packages/oxa-types-py && uv build && uv publish",
"publish:crates": "cd packages/oxa-types-rs && cargo publish"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.2",
"@changesets/cli": "^2.29.8",
"@eslint/js": "^9.39.2",
"eslint": "^9.39.2",
"prettier": "^3.7.4",
Expand Down
3 changes: 3 additions & 0 deletions packages/oxa-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"yaml"
],
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/oxa-dev/oxa.git",
Expand Down
Loading