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
16 changes: 6 additions & 10 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Bump version

# Fetches the latest supergraph schema, diffs it against the committed copy,
# commits the schema update, bumps the version (minor if the schema diff has
# breaking changes, patch otherwise), and pushes a v* tag. Pushing the tag
# Fetches the latest supergraph schema, diffs it against the latest npm release,
# bumps the version (minor for breaking changes, patch otherwise), and pushes
# a v* tag. Pushing the tag
# triggers release.yml, which builds and publishes to npm. The GitHub Release
# notes lead with the schema diff, followed by auto-generated PR notes.
#
Expand Down Expand Up @@ -31,10 +31,11 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Fetch latest schema and diff against committed copy
- name: Fetch latest schema and diff against published package
id: diff
run: |
cp src/resources/schema.graphql /tmp/old-schema.graphql
PREVIOUS_PACKAGE=$(npm pack @codex-data/sdk@latest --pack-destination "$RUNNER_TEMP" --silent)
tar -xOf "$RUNNER_TEMP/$PREVIOUS_PACKAGE" package/schema.graphql > /tmp/old-schema.graphql
pnpm run fetch:schema
pnpm --silent run schema:diff /tmp/old-schema.graphql src/resources/schema.graphql > /tmp/schema-changes.md
cat /tmp/schema-changes.md >> "$GITHUB_STEP_SUMMARY"
Expand All @@ -48,11 +49,6 @@ jobs:
echo "release=false" >> "$GITHUB_OUTPUT"
echo "Schema unchanged and no commits since $LAST_TAG — skipping release." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Commit schema update
if: steps.gate.outputs.release == 'true' && steps.diff.outputs.changed == 'true'
run: |
git add src/resources/schema.graphql
git commit -m "chore: update supergraph schema"
- name: Bump version and tag
if: steps.gate.outputs.release == 'true'
id: bump
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
tags:
- "v*"
workflow_dispatch:
inputs:
dry_run:
description: Build and dry-run publication without uploading a package
type: boolean
default: false

jobs:
publish:
Expand All @@ -24,4 +29,11 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm run build
# Trusted Publishing (OIDC) needs npm >= 11.5.1; Node 24 ships with it.
- run: npm publish --access public
- name: Dry-run publication
if: inputs.dry_run
run: |
npm version prerelease --no-git-tag-version --preid="dry-run.${GITHUB_RUN_ID}"
npm publish --dry-run --access public --tag dry-run
- name: Publish package
if: ${{ !inputs.dry_run }}
run: npm publish --access public
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ coverage
dist
yarn-error.log

# Generated resources (regenerated at build time), except the schema —
# it's tracked so releases record schema changes and builds are reproducible.
# fetch:schema updates it; build reads the committed copy.
# Resources, including the schema, are regenerated at build time.
src/resources/*
!src/resources/schema.graphql

# Published copy of the schema (regenerated by fetch:schema)
/schema.graphql
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codex-data/sdk",
"version": "2.6.3",
"version": "2.6.4",
"engines": {
"node": ">=17.5.0"
},
Expand All @@ -24,14 +24,13 @@
"scripts": {
"prebuild": "pnpm run clean && pnpm run generate:configs",
"clean": "rm -rf dist dist-esm",
"build": "pnpm run copy:schema && pnpm run generate:graphql && pnpm run build:sdk && pnpm run codegen && pnpm run lint ./src/sdk --fix && pnpm run build:types",
"build": "pnpm run fetch:schema && pnpm run generate:graphql && pnpm run build:sdk && pnpm run codegen && pnpm run lint ./src/sdk --fix && pnpm run build:types",
"build:types": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:rename-esm && pnpm run build:edge",
"build:cjs": "tsc",
"build:esm": "tsc -p tsconfig.esm.json",
"build:rename-esm": "find dist-esm -name '*.js' -exec sh -c 'mv \"$1\" \"${1%.js}.mjs\"' _ {} \\; && cp -r dist-esm/* dist/ && rm -rf dist-esm",
"build:edge": "esbuild src/edge.ts --bundle --format=esm --platform=neutral --packages=external --target=es2020 --outfile=dist/edge.mjs",
"fetch:schema": "curl -s https://graph.codex.io/schema/latest.graphql --output src/resources/schema.graphql && cp src/resources/schema.graphql schema.graphql",
"copy:schema": "cp src/resources/schema.graphql schema.graphql",
"fetch:schema": "mkdir -p src/resources && curl --fail --silent --show-error https://graph.codex.io/schema/latest.graphql --output src/resources/schema.graphql && cp src/resources/schema.graphql schema.graphql",
"schema:diff": "tsx src/scripts/schemaDiff.ts",
"generate:configs": "tsx src/scripts/generateNetworkConfigs.ts",
"generate:graphql": "tsx src/scripts/generateGraphql.ts",
Expand All @@ -41,8 +40,8 @@
"test": "pnpm run build:types && jest",
"format": "prettier --write .",
"prepublishOnly": "pnpm run build",
"publish:beta": "pnpm publish --tag beta --access public",
"publish:latest": "pnpm publish --access public"
"publish:beta": "pnpm publish --tag beta --access public --no-git-checks",
"publish:latest": "pnpm publish --access public --no-git-checks"
},
"files": [
"dist/index.js",
Expand Down
Loading
Loading