-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INFRA] Publish schema to Javascript Registry (https://jsr.io/@bids/schema) on changes and releases #1899
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
effigies
added
infrastructure
schema
Issues related to the YAML schema representation of the specification. Patch version release.
labels
Aug 21, 2024
Before merging, I would patch in: diff --git a/.github/workflows/publish_schema.yml b/.github/workflows/publish_schema.yml
index d50ba7f3..b2895664 100644
--- a/.github/workflows/publish_schema.yml
+++ b/.github/workflows/publish_schema.yml
@@ -4,7 +4,6 @@ on:
push:
branches:
- "master"
- - "jsr/*"
tags:
- "schema-*"
@@ -22,6 +21,10 @@ env:
GIT_COMMITTER_NAME: BIDS CI
GIT_COMMITTER_EMAIL: [email protected]
+permissions:
+ contents: write
+ id-token: write
+
jobs:
publish:
runs-on: ubuntu-latest
@@ -76,8 +79,9 @@ jobs:
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
git add jsr.json schema.json context.ts metaschema.ts
git commit -m "Update schema JSR distribution"
+ git push
fi
- name: Publish to JSR
if: success()
run: |
- npx jsr publish --dry-run
+ npx jsr publish |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1899 +/- ##
==========================================
- Coverage 88.10% 87.23% -0.88%
==========================================
Files 16 16
Lines 1396 1410 +14
==========================================
Hits 1230 1230
- Misses 166 180 +14 ☔ View full report in Codecov by Sentry. |
Simulating publish of @bids/[email protected]+e5db69d6 with files:
file:///home/runner/work/bids-specification/bids-specification/LICENSE (18.25KB)
file:///home/runner/work/bids-specification/bids-specification/context.ts (8.46KB)
file:///home/runner/work/bids-specification/bids-specification/jsr.json (191B)
file:///home/runner/work/bids-specification/bids-specification/metaschema.ts (20.11KB)
file:///home/runner/work/bids-specification/bids-specification/schema.json (450.74KB) |
effigies
force-pushed
the
jsr/publish-schema
branch
from
August 26, 2024 20:13
bd45643
to
6ba6974
Compare
rwblair
approved these changes
Aug 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
infrastructure
schema
Issues related to the YAML schema representation of the specification. Patch version release.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a GitHub action that will push dev versions and release versions to https://jsr.io/@bids/schema.
I have been testing this for use in the BIDS validator. Currently we are able to load the schema from the registry via:
We are also able to load the type of the schema with:
The version scheme will be
{schema.schema_version}
if the version is a full release (X.Y.Z), and{schema.schema_version}.{serial}+{hash}
for development versions.The serial number is purely to ensure that development versions of the schema can be ordered, and is derived by parsing the previous version. The purpose of the hash is to help make clear when the content of the schema changes. It currently uses
sha256sum schema.json | head -c 7
, but I think a more useful hash would probably be the latest commit to touch the schema:git log -n 1 --pretty=%h src/schema/
.This PR incidentally changes the name of the
Metaschema
type to justSchema
, soschema
will have typeSchema
.