Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version on release #134

Merged
merged 1 commit into from
Dec 4, 2024
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: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ jobs:
registry-url: https://registry.npmjs.org/
- run: npm run bootstrap
- run: npm run build
- run: node scripts/bump-version.js
- run: |
TAG=$(echo $TAG | cut -c1-8)
gh release create "$TAG" \
VERSION=$(node -p "require('./lerna.json').version")
gh release create "$VERSION" \
--repo="$GITHUB_REPOSITORY" \
--title="${TAG#v}" \
--title="${VERSION#v}" \
--generate-notes \
./lib/*.zip
git config --global user.name 'Release'
git config --global user.email 'release@bot.com'
git commit -am "Bump version ($VERSION)"
git push
env:
TAG: ${{ github.event.pull_request.head.sha || github.sha }}
GH_TOKEN: ${{ github.token }}
22 changes: 22 additions & 0 deletions scripts/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require('fs');
const lernaJson = require('../lerna.json');
const mobxDevtools = require('../packages/mobx-devtools/package.json');
const mobxDevtoolsMst = require('../packages/mobx-devtools-mst/package.json');
const playground = require('../packages/playground/package.json');

const [vMajor, vMinor, vPatch] = lernaJson.version.split('.');

const newVersion = `${vMajor}.${vMinor}.${+vPatch + 1}`;

lernaJson.version = newVersion;

fs.writeFileSync('./lerna.json', JSON.stringify(lernaJson, null, 4), 'utf8');

[
[mobxDevtools, './packages/mobx-devtools/package.json'],
[mobxDevtoolsMst, './packages/mobx-devtools-mst/package.json'],
[playground, './packages/playground/package.json'],
].forEach(([pkg, path]) => {
pkg.version = newVersion;
fs.writeFileSync(path, JSON.stringify(pkg, null, 4), 'utf8');
});
Loading