Skip to content

Commit

Permalink
feat: add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
lotharking committed Feb 10, 2025
1 parent 3b69e6b commit 51871a5
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 24 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
24 changes: 24 additions & 0 deletions .changeset/commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { execSync } = require('node:child_process')

const getSignedOffBy = () => {
const gitUserName = execSync('git config user.name').toString('utf-8').trim()
const gitEmail = execSync('git config user.email').toString('utf-8').trim()

return `Signed-off-by: ${gitUserName} <${gitEmail}>`
}

const getAddMessage = async (changeset) => {
return `docs(changeset): ${changeset.summary}\n\n${getSignedOffBy()}\n`
}

const getVersionMessage = async (releasePlan) => {
const publishableReleases = releasePlan.releases.filter((release) => release.type !== 'none')
const releasedVersion = publishableReleases[0].newVersion

return `chore(release): version ${releasedVersion}\n\n${getSignedOffBy()}\n`
}

module.exports = {
getAddMessage,
getVersionMessage,
}
17 changes: 17 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": "./commit",
"privatePackages": false,
"fixed": [
["@2060.io/service-agent-model"],
["@2060.io/service-agent-client"],
["@2060.io/service-agent-nestjs-client"]
],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"snapshot": {
"useCalculatedVersion": true
}
}
24 changes: 9 additions & 15 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,16 @@ jobs:
docker push $DH_USERNAME/$DEMO_CHATBOT_IMAGE_NAME:$IMAGE_TAG
- name: Publish NPM packages
id: changesets
if: steps.semantic.outputs.new-release-published == 'true'
uses: changesets/action@v1
with:
title: 'chore(release): new version'
commit: 'chore(release): new version'
publish: yarn release
version: yarn changeset-version
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Publish Model
yarn workspace @2060.io/service-agent-model version --no-git-tag-version --new-version $RELEASE_VERSION
yarn workspace @2060.io/service-agent-model publish --non-interactive
# Publish Client
yarn workspace @2060.io/service-agent-client add @2060.io/service-agent-model@$RELEASE_VERSION
yarn workspace @2060.io/service-agent-client version --no-git-tag-version --new-version $RELEASE_VERSION
yarn workspace @2060.io/service-agent-client publish --non-interactive
# Publish Nestjs-client
yarn workspace @2060.io/service-agent-nestjs-client add @2060.io/service-agent-client@$RELEASE_VERSION
yarn workspace @2060.io/service-agent-nestjs-client add @2060.io/service-agent-model@$RELEASE_VERSION
yarn workspace @2060.io/service-agent-nestjs-client version --no-git-tag-version --new-version $RELEASE_VERSION
yarn workspace @2060.io/service-agent-nestjs-client publish --non-interactive
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}


7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
"check-format": "prettier -c \"packages/*/src/**/*.ts\"",
"test": "yarn workspaces run test --passWithNoTests",
"lint": "eslint \"{packages,apps,libs}/**/*.ts\" --fix",
"validate": "yarn lint && yarn check-types && yarn check-format"
"validate": "yarn lint && yarn check-types && yarn check-format",
"release": "yarn build && yarn changeset publish --no-git-tag",
"changeset-version": "yarn changeset version && yarn format"
},
"devDependencies": {
"@changesets/cli": "^2.27.12",
"@types/jest": "^29.5.0",
"@types/node": "^20.11.19",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@types/supertest": "^2.0.12",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down
Loading

0 comments on commit 51871a5

Please sign in to comment.