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
12 changes: 12 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@ts-contract/docs": "0.0.0",
"@ts-contract/core": "0.0.1",
"@ts-contract/plugins": "0.0.1"
},
"changesets": [
"upset-eyes-brush"
]
}
6 changes: 6 additions & 0 deletions .changeset/upset-eyes-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@ts-contract/core': major
'@ts-contract/plugins': major
---

First alpha release of ts-contract - schema-first TypeScript contract library with core contract definitions and built-in plugins for path building and validation
57 changes: 53 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,57 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub Release
- name: Create GitHub Releases
if: steps.changesets.outputs.published == 'true'
run: |
echo "Packages published:"
echo "${{ steps.changesets.outputs.publishedPackages }}"
uses: actions/github-script@v7
with:
script: |
const publishedPackages = JSON.parse('${{ steps.changesets.outputs.publishedPackages }}');

for (const pkg of publishedPackages) {
const tagName = `${pkg.name}@${pkg.version}`;
const releaseName = `${pkg.name} v${pkg.version}`;

// Read the changelog for this package
const fs = require('fs');
const path = require('path');

let changelogPath;
if (pkg.name === '@ts-contract/core') {
changelogPath = 'packages/core/CHANGELOG.md';
} else if (pkg.name === '@ts-contract/plugins') {
changelogPath = 'packages/plugins/CHANGELOG.md';
}

let releaseNotes = `Release of ${pkg.name} version ${pkg.version}`;

if (changelogPath && fs.existsSync(changelogPath)) {
const changelog = fs.readFileSync(changelogPath, 'utf8');
// Extract the latest version's notes
const versionHeader = `## ${pkg.version}`;
const startIndex = changelog.indexOf(versionHeader);
if (startIndex !== -1) {
const afterHeader = changelog.slice(startIndex + versionHeader.length);
const nextVersionIndex = afterHeader.indexOf('\n## ');
const notes = nextVersionIndex !== -1
? afterHeader.slice(0, nextVersionIndex)
: afterHeader;
releaseNotes = notes.trim();
}
}

try {
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: releaseName,
body: releaseNotes,
prerelease: pkg.version.includes('-alpha') || pkg.version.includes('-beta'),
draft: false
});
console.log(`Created release for ${tagName}`);
} catch (error) {
console.error(`Failed to create release for ${tagName}:`, error.message);
}
}
7 changes: 7 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @ts-contract/core

## 1.0.0-alpha.0

### Major Changes

- First alpha release of ts-contract - schema-first TypeScript contract library with core contract definitions and built-in plugins for path building and validation
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-contract/core",
"version": "0.0.1",
"version": "1.0.0-alpha.0",
"description": "Contract definitions, type inference helpers, and plugin system for ts-contract",
"type": "module",
"main": "./dist/index.js",
Expand Down
12 changes: 12 additions & 0 deletions packages/plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# @ts-contract/plugins

## 1.0.0-alpha.0

### Major Changes

- First alpha release of ts-contract - schema-first TypeScript contract library with core contract definitions and built-in plugins for path building and validation

### Patch Changes

- Updated dependencies
- @ts-contract/core@1.0.0-alpha.0
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-contract/plugins",
"version": "0.0.1",
"version": "1.0.0-alpha.0",
"description": "Built-in plugins for path building and schema validation for ts-contract",
"type": "module",
"main": "./dist/index.js",
Expand Down