Skip to content

Commit 109d3dd

Browse files
author
Disturbing
committed
feat: add GitHub release creation to workflow
1 parent 90d0e62 commit 109d3dd

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ jobs:
4848
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
4949
5050
- name: Version and Publish
51+
id: publish
5152
run: |
5253
# Apply changesets (update version numbers)
5354
yarn changeset version
5455
56+
# Extract versions for release notes
57+
MCP_VERSION=$(node -p "require('./packages/mcp/package.json').version")
58+
TEST_UTILS_VERSION=$(node -p "require('./packages/test-utils/package.json').version")
59+
echo "MCP_VERSION=${MCP_VERSION}" >> $GITHUB_OUTPUT
60+
echo "TEST_UTILS_VERSION=${TEST_UTILS_VERSION}" >> $GITHUB_OUTPUT
61+
echo "RELEASE_TAG=v${MCP_VERSION}" >> $GITHUB_OUTPUT
62+
5563
# Commit the version updates
5664
git add .
5765
git commit -m "chore(release): version packages" || echo "No changes to commit"
@@ -69,8 +77,54 @@ jobs:
6977
7078
# Push the version updates and tags
7179
git push origin main
80+
81+
# Create and push a version tag
82+
git tag -a "v${MCP_VERSION}" -m "Release v${MCP_VERSION}"
7283
git push --tags
7384
env:
7485
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
7586
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
76-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
87+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
88+
89+
- name: Create GitHub Release
90+
uses: actions/github-script@v7
91+
with:
92+
github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
93+
script: |
94+
const { RELEASE_TAG, MCP_VERSION, TEST_UTILS_VERSION } = process.env;
95+
96+
// Get the commits since the last tag
97+
const { data: commits } = await github.rest.repos.listCommits({
98+
owner: context.repo.owner,
99+
repo: context.repo.repo,
100+
per_page: 10
101+
});
102+
103+
// Create a nice markdown body
104+
const body = `
105+
## Packages
106+
107+
- @xava-labs/mcp: ${MCP_VERSION}
108+
- @xava-labs/test-utils: ${TEST_UTILS_VERSION}
109+
110+
## Recent Changes
111+
112+
${commits.slice(0, 5).map(commit => (
113+
`- ${commit.commit.message} (${commit.sha.substring(0, 7)})`
114+
)).join('\n')}
115+
`;
116+
117+
// Create the release
118+
await github.rest.repos.createRelease({
119+
owner: context.repo.owner,
120+
repo: context.repo.repo,
121+
tag_name: RELEASE_TAG,
122+
name: `Release ${RELEASE_TAG}`,
123+
body: body,
124+
draft: false,
125+
prerelease: false
126+
});
127+
env:
128+
RELEASE_TAG: ${{ steps.publish.outputs.RELEASE_TAG }}
129+
MCP_VERSION: ${{ steps.publish.outputs.MCP_VERSION }}
130+
TEST_UTILS_VERSION: ${{ steps.publish.outputs.TEST_UTILS_VERSION }}

0 commit comments

Comments
 (0)