mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 20:06:32 +00:00
Added a script to update the versions.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
f1bffaab2d
commit
00a3ee34c8
32
README.md
32
README.md
@ -87,6 +87,38 @@ This project is built on [GitHub Actions](https://github.com/bcmi-labs/arduino-e
|
||||
git push origin 1.2.3
|
||||
```
|
||||
|
||||
### Creating a GH release
|
||||
This section guides you through how to create a new release. Let's assume the current version is `0.1.3` and you want to release `0.2.0`.
|
||||
|
||||
- Make sure the `master` state represents what you want to release and you're on `master`.
|
||||
- Prepare a release-candidate build on a branch:
|
||||
```bash
|
||||
git branch 0.2.0-rc \
|
||||
&& git checkout 0.2.0-rc
|
||||
```
|
||||
- Bump up the version number. It must be a valid [semver](https://semver.org/) and must be greater than the current one:
|
||||
```bash
|
||||
yarn update:version 0.2.0
|
||||
```
|
||||
- This should generate multiple outgoing changes with the version update.
|
||||
- Commit your changes and push to the remote:
|
||||
```bash
|
||||
git add . \
|
||||
&& git commit -s -m "Updated versions to 0.2.0" \
|
||||
&& git push
|
||||
```
|
||||
- Create the GH PR the workflow starts automatically.
|
||||
- Once you're happy with the RC, merge the changes to the `master`.
|
||||
- Create a tag and push it:
|
||||
```bash
|
||||
git tag -a 0.2.0 -m "0.2.0" \
|
||||
&& git push origin 0.2.0
|
||||
```
|
||||
- The release build starts automatically and uploads the artifacts with the changelog to the Pro IDE [release page](https://github.com/arduino/arduino-pro-ide/releases).
|
||||
- If you do not want to release the `EXE` and `MSI` installers, wipe them manually.
|
||||
- If you do not like the generated changelog, modify it and update the GH release.
|
||||
|
||||
|
||||
### FAQ
|
||||
|
||||
- Q: Can I manually change the version of the [`arduino-cli`](https://github.com/arduino/arduino-cli/) used by the IDE?
|
||||
|
@ -14,6 +14,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"lerna": "^3.20.2",
|
||||
"rimraf": "^2.6.1",
|
||||
"semver": "^7.3.2",
|
||||
"tslint": "^5.5.0",
|
||||
"typescript": "^3.9.2"
|
||||
},
|
||||
@ -24,7 +25,8 @@
|
||||
"start": "yarn --cwd ./electron-app start",
|
||||
"watch": "lerna run watch --parallel",
|
||||
"test": "lerna run test",
|
||||
"download:plugins": "theia download:plugins"
|
||||
"download:plugins": "theia download:plugins",
|
||||
"update:version": "node ./scripts/update-version.js"
|
||||
},
|
||||
"workspaces": [
|
||||
"arduino-ide-extension",
|
||||
|
48
scripts/update-version.js
Normal file
48
scripts/update-version.js
Normal file
@ -0,0 +1,48 @@
|
||||
//@ts-check
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const semver = require('semver');
|
||||
|
||||
const targetVersion = process.argv.slice(2).shift();
|
||||
const repoRootPath = path.join(__dirname, '..');
|
||||
const { version: currentVersion } = require(path.join(repoRootPath, 'package.json'));
|
||||
|
||||
if (!targetVersion) {
|
||||
console.error('Target version was not specified. Target version must be a valid semver. Use: `yarn update:version x.y.z` to update the versions.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!semver.valid(targetVersion)) {
|
||||
console.error(`Target version '${targetVersion}' is not a valid semver. Use: \`yarn update:version x.y.z\` to update the versions.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!semver.gt(targetVersion, currentVersion)) {
|
||||
console.error(`Target version '${targetVersion}' must be greater than the current version '${currentVersion}.'`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`🛠️ Updating current version from '${currentVersion}' to '${targetVersion}':`);
|
||||
for (const toUpdate of [
|
||||
path.join(repoRootPath, 'package.json'),
|
||||
path.join(repoRootPath, 'electron-app', 'package.json'),
|
||||
path.join(repoRootPath, 'browser-app', 'package.json'),
|
||||
path.join(repoRootPath, 'arduino-ide-extension', 'package.json'),
|
||||
path.join(repoRootPath, 'arduino-debugger-extension', 'package.json') // Currently unused. The debugger functionality comes from the `cortex.debug` VS Code extension.
|
||||
]) {
|
||||
process.stdout.write(` Updating ${toUpdate}'...`);
|
||||
const pkg = require(toUpdate);
|
||||
pkg.version = targetVersion;
|
||||
if ('dependencies' in pkg) {
|
||||
for (const dep of Object.keys(pkg['dependencies'])) {
|
||||
if (dep.startsWith('arduino-')) {
|
||||
pkg['dependencies'][dep] = targetVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(toUpdate, JSON.stringify(pkg, null, 2) + '\n');
|
||||
process.stdout.write(` ✅ Done.\n`);
|
||||
}
|
||||
|
||||
console.log(`Done. The new version is '${targetVersion}' now. Commit your changes and tag the code for the release. 🚢`);
|
Loading…
x
Reference in New Issue
Block a user