Skip to content

Commit 98ecd47

Browse files
authored
Merge pull request #51 from hypercerts-org/prep-release
2 parents 94a6474 + 7400b3c commit 98ecd47

File tree

4 files changed

+111
-39
lines changed

4 files changed

+111
-39
lines changed

.changeset/beige-clowns-relax.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
"@hypercerts-org/lexicon": major
3+
---
4+
5+
This major release represents the migration of the lexicon package from the SDK monorepo (`hypercerts-sdk/packages/lexicon`) to a dedicated standalone repository (`hypercerts-lexicon`). This separation allows for independent versioning and development of the lexicon definitions.
6+
7+
Major architectural and feature updates compared to the SDK lexicon package include but are not limited to the following:
8+
9+
**New Lexicons:**
10+
11+
- Activity model: `org.hypercerts.claim.activity` - activity-based hypercert records (replaces single claim model)
12+
- Project records: `org.hypercerts.claim.project` - projects that group multiple activities
13+
- Shared definitions: `org.hypercerts.defs` - common types (uri, smallBlob, largeBlob, smallImage, largeImage)
14+
- Badge system: `app.certified.badge.definition`, `app.certified.badge.award`, `app.certified.badge.response` for badge-based endorsements
15+
- Funding receipts: `org.hypercerts.funding.receipt` - payment and funding tracking
16+
17+
**Architectural Changes:**
18+
19+
- **Claim model**: Replaced single `org.hypercerts.claim` record with activity-based `org.hypercerts.claim.activity` model
20+
- **Collection model**: Collections now reference activities (via `activityWeight`) instead of claims (via `claimItem`)
21+
- **Work scope**: Activity model uses structured `workScope` object with label-based conditions (`withinAllOf`, `withinAnyOf`, `withinNoneOf`)
22+
- **Time fields**: Activity uses `startDate`/`endDate` instead of `workTimeFrameFrom`/`workTimeFrameTo`
23+
- **Image references**: Activity model references `org.hypercerts.defs#smallImage` instead of `app.certified.defs#uri`/`smallBlob`
24+
25+
**Definition Updates:**
26+
27+
- `app.certified.defs` now includes `did` type definition
28+
- Added `org.hypercerts.defs` with image and blob type definitions
29+
- Activity model references project via AT-URI instead of strongRef
30+
31+
**Removed/Replaced:**
32+
33+
- `org.hypercerts.claim` (replaced by `org.hypercerts.claim.activity`)
34+
- Top-level `org.hypercerts.collection` (replaced by `org.hypercerts.claim.collection` using activities)

.github/workflows/release-beta.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ jobs:
2020
- name: Check RELEASE_PAT secret exists
2121
run: |
2222
if [ -z "${{ secrets.RELEASE_PAT }}" ]; then
23-
echo "Error: RELEASE_PAT secret is required but not set"
24-
echo "This workflow requires a Personal Access Token to bypass branch protection rules"
23+
echo "Error: RELEASE_PAT secret is required but not set."
24+
echo "This workflow requires a Personal Access Token to bypass branch protection rules."
25+
echo "See PUBLISHING.md."
2526
exit 1
2627
fi
2728
- uses: actions/checkout@v6

PUBLISHING.md

Lines changed: 73 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,125 @@
11
# Publishing Guide for Maintainers
22

33
This document describes how to publish the `@hypercerts-org/lexicon`
4-
package to npm using GitHub Actions workflows. All publishing
5-
workflows are manually triggered to give you full control over when
6-
releases are made.
4+
package to npm using GitHub Actions workflows with Changesets. All
5+
publishing workflows are manually triggered to give you full control
6+
over when releases are made.
77

88
## Prerequisites
99

1010
Before publishing, ensure you have:
1111

1212
1. **GitHub Secrets configured:**
13-
- `GH_PA_TOKEN`: GitHub Personal Access Token with permissions for
14-
releases
13+
- `RELEASE_PAT`: GitHub Personal Access Token with permissions to bypass
14+
branch protection rules. Required for the beta release workflow that
15+
commits and pushes version changes to protected branches.
16+
- **Recommended:** Fine-grained Personal Access Token
17+
- Create at: <https://github.com/settings/tokens?type=beta>
18+
- Repository access: Select this repository
19+
- Repository permissions: `Contents` (read and write), `Metadata`
20+
(read-only)
21+
- **Alternative:** Classic Personal Access Token (if fine-grained
22+
doesn't work with your branch protection settings)
23+
- Create at: <https://github.com/settings/tokens>
24+
- Required scopes: `repo` (full control of private repositories)
25+
- This is needed because `GITHUB_TOKEN` cannot bypass branch protection
26+
- **Note:** Ensure branch protection rules allow the token to bypass
27+
protection (uncheck "Do not allow bypassing the above settings" or
28+
add the token as an allowed actor)
1529
- `NPM_TOKEN`: npm access token with publish permissions for
1630
`@hypercerts-org` scope
1731

18-
2. **GitHub Environments configured:**
19-
- `test`: For the build-and-test job
20-
- `staging`: For the semantic-release job
32+
## Adding Changesets
2133

22-
## Publishing a Release
34+
Before publishing, you need to create changesets for any user-facing
35+
changes:
2336

24-
To publish a new release to npm:
37+
```bash
38+
npm run changeset
39+
```
40+
41+
This will:
42+
43+
1. Prompt you to select which packages changed
44+
2. Ask for the version bump type (major/minor/patch)
45+
3. Create a markdown file in `.changeset/` with your changes
46+
47+
**Note:** Changesets generates files with random names (e.g.,
48+
`beige-clowns-relax.md`). This is intentional to prevent filename
49+
collisions when multiple contributors create changesets simultaneously.
50+
The filename doesn't affect version ordering—Changesets uses git history
51+
to determine the order of changes. You can rename these files if desired,
52+
but it's not necessary and not recommended in collaborative environments.
53+
54+
## Publishing a Stable Release
55+
56+
To publish a stable release to npm:
2557

2658
1. **Navigate to GitHub Actions:**
2759
- Go to the repository on GitHub
2860
- Click on the "Actions" tab
2961

3062
2. **Select the workflow:**
31-
- Choose "Build and release" from the workflow list
63+
- Choose "Release" from the workflow list
3264

3365
3. **Run the workflow:**
3466
- Click "Run workflow"
3567
- Select the branch (typically `main`)
3668
- Click "Run workflow" to start
3769

3870
4. **What happens:**
39-
- The workflow runs linting and regenerates TypeScript types
40-
- If successful, semantic-release analyzes your commits
41-
- If there are version-worthy changes, it:
42-
- Determines the new version based on
43-
[Conventional Commits](https://www.conventionalcommits.org/)
44-
- Updates `CHANGELOG.md`
45-
- Creates a GitHub release
46-
- Publishes to npm with the new version
71+
- The workflow validates the code and regenerates TypeScript types
72+
- If there are pending changesets, it creates a "Release Pull Request"
73+
- Merge the Release PR to publish to npm with the `latest` tag
74+
- If no changesets exist, nothing is published
4775

48-
## Publishing a Prerelease
76+
## Publishing a Beta Release
4977

5078
To publish a beta/prerelease version:
5179

5280
1. **Navigate to GitHub Actions:**
5381
- Go to the "Actions" tab
5482

55-
2. **Select the prerelease workflow:**
56-
- Choose "Build and release - staging"
83+
2. **Select the workflow:**
84+
- Choose "Release Beta"
5785

5886
3. **Run the workflow:**
5987
- Click "Run workflow"
60-
- Select the branch (typically `develop` or a feature branch)
88+
- Select the branch (must be `main`)
6189
- Click "Run workflow"
6290

6391
4. **What happens:**
64-
- Same process as above, but publishes with a `beta` tag
65-
- Version format: `1.2.3-beta.1`, `1.2.3-beta.2`, etc.
92+
- The workflow enters beta prerelease mode (if not already)
93+
- Versions packages based on pending changesets
94+
- Publishes to npm with the `beta` tag
95+
- Version format: `0.9.0-beta.1`, `0.9.0-beta.2`, etc.
96+
- Commits and pushes version changes back to the repository
97+
98+
**Note:** This workflow requires the `RELEASE_PAT` secret to bypass
99+
branch protection rules when pushing version changes.
66100

67101
## Validating Releases (PRs)
68102

69-
When you open a pull request, the "Build and release - staging"
70-
workflow automatically runs in dry-run mode to:
103+
When you open a pull request, the "PR Check" workflow automatically
104+
runs to:
71105

72-
- Validate that the code builds successfully
73-
- Check that types regenerate correctly
74-
- Show what version would be released (without actually publishing)
106+
- Check if package changes (lexicons, types, package.json) have
107+
corresponding changesets
108+
- Warn if changesets are missing
75109

76-
This helps catch issues before merging.
110+
This helps ensure all user-facing changes are properly documented
111+
before merging.
77112

78113
## Version Management
79114

80-
Versions are automatically determined by semantic-release based on
81-
commit messages:
115+
Versions are determined by Changesets:
116+
117+
- **Patch**: Bug fixes and minor updates (0.9.0 → 0.9.1)
118+
- **Minor**: New features (0.9.0 → 0.10.0)
119+
- **Major**: Breaking changes (0.9.0 → 1.0.0)
82120

83-
- `feat:` → minor version bump (1.0.0 → 1.1.0)
84-
- `fix:` → patch version bump (1.0.0 → 1.0.1)
85-
- `BREAKING CHANGE:` or `!` → major version bump (1.0.0 → 2.0.0)
121+
You specify the version bump type when creating a changeset with
122+
`npm run changeset`.
86123

87124
The `prepublishOnly` script ensures types are regenerated before
88125
publishing, so the published package always includes the latest

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hypercerts-org/lexicon",
3-
"version": "0.1.0",
3+
"version": "0.9.0",
44
"description": "ATProto lexicon definitions and TypeScript types for the Hypercerts protocol",
55
"type": "module",
66
"main": "./types/index.ts",

0 commit comments

Comments
 (0)