Skip to content

Commit

Permalink
fix: Semantic Release
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Nov 12, 2024
1 parent 1632501 commit 6604968
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Install semantic-release
run: |
npm install --save-dev semantic-release @semantic-release/git @semantic-release/github
npm install --save-dev semantic-release @semantic-release/git @semantic-release/github @semantic-release/exec
- name: Build package
run: npm run build
Expand Down
11 changes: 7 additions & 4 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
["@semantic-release/npm", {
"npmPublish": true
}],
["@semantic-release/github", {
"labels": ["release-candidate"],
"releasedLabels": ["released-rc"]
["@semantic-release/exec", {
"prepareCmd": "node update-version.js ${nextRelease.version}"
}],
["@semantic-release/git", {
"assets": ["package.json"],
"assets": ["package.json", "src/version.ts"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@semantic-release/github", {
"labels": ["release-candidate"],
"releasedLabels": ["released-rc"]
}]
]
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai21",
"version": "0.0.0",
"version": "v1.0.0-rc.1",
"description": "AI21 TypeScript SDK",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 1 addition & 3 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { version } from '../package.json';

export const VERSION = version;
export const VERSION = "1.0.0-rc.1";
7 changes: 7 additions & 0 deletions update-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require('fs');
const path = require('path');

const versionFilePath = path.resolve(__dirname, 'src/version.ts');
const newVersion = process.argv[2];

fs.writeFileSync(versionFilePath, `export const VERSION = '${newVersion}';\n`, 'utf8');

0 comments on commit 6604968

Please sign in to comment.