build: update support.md on stable version bumps (#29381)
* build: update support.md on stable version bumps * build: update supported on major stable & nightly bumps * test: updateSupported tests * chore: fix syntax * chore: use fspromise in version-bumper script/spec
This commit is contained in:
parent
8ce63a9f18
commit
d8d6e2ebc0
3 changed files with 257 additions and 6 deletions
|
@ -1,17 +1,17 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { GitProcess } = require('dugite');
|
||||
const fs = require('fs');
|
||||
const { promises: fs } = require('fs');
|
||||
const semver = require('semver');
|
||||
const path = require('path');
|
||||
const { promisify } = require('util');
|
||||
const minimist = require('minimist');
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils');
|
||||
const versionUtils = require('./version-utils');
|
||||
const supported = path.resolve(ELECTRON_DIR, 'docs', 'tutorial', 'support.md');
|
||||
|
||||
const writeFile = promisify(fs.writeFile);
|
||||
const readFile = promisify(fs.readFile);
|
||||
const writeFile = fs.writeFile;
|
||||
const readFile = fs.readFile;
|
||||
|
||||
function parseCommandLine () {
|
||||
let help;
|
||||
|
@ -54,6 +54,10 @@ async function main () {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (shouldUpdateSupported(opts.bump, currentVersion, version)) {
|
||||
await updateSupported(version, supported);
|
||||
}
|
||||
|
||||
// update all version-related files
|
||||
await Promise.all([
|
||||
updateVersion(version),
|
||||
|
@ -105,6 +109,22 @@ async function nextVersion (bumpType, version) {
|
|||
return version;
|
||||
}
|
||||
|
||||
function shouldUpdateSupported (bump, current, version) {
|
||||
return isMajorStable(bump, current) || isMajorNightly(version, current);
|
||||
}
|
||||
|
||||
function isMajorStable (bump, currentVersion) {
|
||||
if (versionUtils.isBeta(currentVersion) && (bump === 'stable')) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMajorNightly (version, currentVersion) {
|
||||
const parsed = semver.parse(version);
|
||||
const current = semver.parse(currentVersion);
|
||||
if (versionUtils.isNightly(currentVersion) && (parsed.major > current.major)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// update VERSION file with latest release info
|
||||
async function updateVersion (version) {
|
||||
const versionPath = path.resolve(ELECTRON_DIR, 'ELECTRON_VERSION');
|
||||
|
@ -142,6 +162,22 @@ async function updateWinRC (components) {
|
|||
await writeFile(filePath, arr.join('\n'));
|
||||
}
|
||||
|
||||
// updates support.md file with new semver values (stable only)
|
||||
async function updateSupported (version, filePath) {
|
||||
const v = parseInt(version);
|
||||
const newVersions = [`* ${v}.x.y`, `* ${v - 1}.x.y`, `* ${v - 2}.x.y`];
|
||||
const contents = await readFile(filePath, 'utf8');
|
||||
const previousVersions = contents.split('\n').filter((elem) => {
|
||||
return (/[^\n]*\.x\.y[^\n]*/).test(elem);
|
||||
}, []);
|
||||
|
||||
const newContents = previousVersions.reduce((contents, current, i) => {
|
||||
return contents.replace(current, newVersions[i]);
|
||||
}, contents);
|
||||
|
||||
await writeFile(filePath, newContents, 'utf8');
|
||||
}
|
||||
|
||||
if (process.mainModule === module) {
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
|
@ -149,4 +185,4 @@ if (process.mainModule === module) {
|
|||
});
|
||||
}
|
||||
|
||||
module.exports = { nextVersion };
|
||||
module.exports = { nextVersion, shouldUpdateSupported, updateSupported };
|
||||
|
|
121
spec-main/fixtures/version-bumper/fixture_support.md
Normal file
121
spec-main/fixtures/version-bumper/fixture_support.md
Normal file
|
@ -0,0 +1,121 @@
|
|||
# Electron Support
|
||||
|
||||
## Finding Support
|
||||
|
||||
If you have a security concern,
|
||||
please see the [security document](https://github.com/electron/electron/tree/master/SECURITY.md).
|
||||
|
||||
If you're looking for programming help,
|
||||
for answers to questions,
|
||||
or to join in discussion with other developers who use Electron,
|
||||
you can interact with the community in these locations:
|
||||
|
||||
* [`Electron's Discord`](https://discord.com/invite/electron) has channels for:
|
||||
* Getting help
|
||||
* Ecosystem apps like [Electron Forge](https://github.com/electron-userland/electron-forge) and [Electron Fiddle](https://github.com/electron/fiddle)
|
||||
* Sharing ideas with other Electron app developers
|
||||
* And more!
|
||||
* [`electron`](https://discuss.atom.io/c/electron) category on the Atom forums
|
||||
* `#atom-shell` channel on Freenode
|
||||
* `#electron` channel on [Atom's Slack](https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406)
|
||||
* [`electron-ru`](https://telegram.me/electron_ru) *(Russian)*
|
||||
* [`electron-br`](https://electron-br.slack.com) *(Brazilian Portuguese)*
|
||||
* [`electron-kr`](https://electron-kr.github.io/electron-kr) *(Korean)*
|
||||
* [`electron-jp`](https://electron-jp.slack.com) *(Japanese)*
|
||||
* [`electron-tr`](https://electron-tr.herokuapp.com) *(Turkish)*
|
||||
* [`electron-id`](https://electron-id.slack.com) *(Indonesia)*
|
||||
* [`electron-pl`](https://electronpl.github.io) *(Poland)*
|
||||
|
||||
If you'd like to contribute to Electron,
|
||||
see the [contributing document](https://github.com/electron/electron/blob/master/CONTRIBUTING.md).
|
||||
|
||||
If you've found a bug in a [supported version](#supported-versions) of Electron,
|
||||
please report it with the [issue tracker](../development/issues.md).
|
||||
|
||||
[awesome-electron](https://github.com/sindresorhus/awesome-electron)
|
||||
is a community-maintained list of useful example apps,
|
||||
tools and resources.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The latest three *stable* major versions are supported by the Electron team.
|
||||
For example, if the latest release is 6.1.x, then the 5.0.x as well
|
||||
as the 4.2.x series are supported. We only support the latest minor release
|
||||
for each stable release series. This means that in the case of a security fix
|
||||
6.1.x will receive the fix, but we will not release a new version of 6.0.x.
|
||||
|
||||
The latest stable release unilaterally receives all fixes from `master`,
|
||||
and the version prior to that receives the vast majority of those fixes
|
||||
as time and bandwidth warrants. The oldest supported release line will receive
|
||||
only security fixes directly.
|
||||
|
||||
All supported release lines will accept external pull requests to backport
|
||||
fixes previously merged to `master`, though this may be on a case-by-case
|
||||
basis for some older supported lines. All contested decisions around release
|
||||
line backports will be resolved by the [Releases Working Group](https://github.com/electron/governance/tree/master/wg-releases) as an agenda item at their weekly meeting the week the backport PR is raised.
|
||||
|
||||
When an API is changed or removed in a way that breaks existing functionality, the
|
||||
previous functionality will be supported for a minimum of two major versions when
|
||||
possible before being removed. For example, if a function takes three arguments,
|
||||
and that number is reduced to two in major version 10, the three-argument version would
|
||||
continue to work until, at minimum, major version 12. Past the minimum two-version
|
||||
threshold, we will attempt to support backwards compatibility beyond two versions
|
||||
until the maintainers feel the maintenance burden is too high to continue doing so.
|
||||
|
||||
### Currently supported versions
|
||||
|
||||
* 3.x.y
|
||||
* 2.x.y
|
||||
* 1.x.y
|
||||
|
||||
### End-of-life
|
||||
|
||||
When a release branch reaches the end of its support cycle, the series
|
||||
will be deprecated in NPM and a final end-of-support release will be
|
||||
made. This release will add a warning to inform that an unsupported
|
||||
version of Electron is in use.
|
||||
|
||||
These steps are to help app developers learn when a branch they're
|
||||
using becomes unsupported, but without being excessively intrusive
|
||||
to end users.
|
||||
|
||||
If an application has exceptional circumstances and needs to stay
|
||||
on an unsupported series of Electron, developers can silence the
|
||||
end-of-support warning by omitting the final release from the app's
|
||||
`package.json` `devDependencies`. For example, since the 1-6-x series
|
||||
ended with an end-of-support 1.6.18 release, developers could choose
|
||||
to stay in the 1-6-x series without warnings with `devDependency` of
|
||||
`"electron": 1.6.0 - 1.6.17`.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
Following platforms are supported by Electron:
|
||||
|
||||
### macOS
|
||||
|
||||
Only 64bit binaries are provided for macOS, and the minimum macOS version
|
||||
supported is macOS 10.11 (El Capitan).
|
||||
|
||||
Native support for Apple Silicon (`arm64`) devices was added in Electron 11.0.0.
|
||||
|
||||
### Windows
|
||||
|
||||
Windows 7 and later are supported, older operating systems are not supported
|
||||
(and do not work).
|
||||
|
||||
Both `ia32` (`x86`) and `x64` (`amd64`) binaries are provided for Windows.
|
||||
[Native support for Windows on Arm (`arm64`) devices was added in Electron 6.0.8.](windows-arm.md).
|
||||
Running apps packaged with previous versions is possible using the ia32 binary.
|
||||
|
||||
### Linux
|
||||
|
||||
The prebuilt binaries of Electron are built on Ubuntu 18.04.
|
||||
|
||||
Whether the prebuilt binary can run on a distribution depends on whether the
|
||||
distribution includes the libraries that Electron is linked to on the building
|
||||
platform, so only Ubuntu 18.04 is guaranteed to work, but following platforms
|
||||
are also verified to be able to run the prebuilt binaries of Electron:
|
||||
|
||||
* Ubuntu 14.04 and newer
|
||||
* Fedora 24 and newer
|
||||
* Debian 8 and newer
|
|
@ -1,7 +1,13 @@
|
|||
import { expect } from 'chai';
|
||||
import { nextVersion } from '../script/release/version-bumper';
|
||||
import { nextVersion, shouldUpdateSupported, updateSupported } from '../script/release/version-bumper';
|
||||
import * as utils from '../script/release/version-utils';
|
||||
import { ifdescribe } from './spec-helpers';
|
||||
const { promises: fs } = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const fixtureDir = path.resolve(__dirname, 'fixtures', 'version-bumper', 'fixture_support.md');
|
||||
const readFile = fs.readFile;
|
||||
const writeFile = fs.writeFile;
|
||||
|
||||
describe('version-bumper', () => {
|
||||
describe('makeVersion', () => {
|
||||
|
@ -41,6 +47,94 @@ describe('version-bumper', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('updateSupported', () => {
|
||||
let restore: any;
|
||||
before(async () => {
|
||||
restore = await readFile(fixtureDir, 'utf8');
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await writeFile(fixtureDir, restore, 'utf8');
|
||||
});
|
||||
|
||||
it('updates correctly when a new stable version is promoted from beta', async () => {
|
||||
const version = '4.0.0';
|
||||
const currentVersion = '4.0.0-beta.29';
|
||||
if (shouldUpdateSupported('stable', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('4.x.y\n* 3.x.y\n* 2.x.y');
|
||||
});
|
||||
|
||||
it('should not update when a new stable patch version is promoted', async () => {
|
||||
const version = '3.0.1';
|
||||
const currentVersion = '3.0.0';
|
||||
if (shouldUpdateSupported('stable', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('3.x.y\n* 2.x.y\n* 1.x.y');
|
||||
});
|
||||
|
||||
it('should not update when a new stable minor version is promoted', async () => {
|
||||
const version = '3.1.0';
|
||||
const currentVersion = '3.0.0';
|
||||
if (shouldUpdateSupported('minor', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('3.x.y\n* 2.x.y\n* 1.x.y');
|
||||
});
|
||||
|
||||
it('should not update when a new beta.1 version is promoted', async () => {
|
||||
const version = '5.0.0-beta.1';
|
||||
const currentVersion = '4.0.0-beta.29';
|
||||
if (shouldUpdateSupported('beta', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('3.x.y\n* 2.x.y\n* 1.x.y');
|
||||
});
|
||||
|
||||
it('should not update when a new beta.12 version is promoted', async () => {
|
||||
const version = '4.0.0-beta.12';
|
||||
const currentVersion = '4.0.0-beta.11';
|
||||
if (shouldUpdateSupported('beta', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('3.x.y\n* 2.x.y\n* 1.x.y');
|
||||
});
|
||||
|
||||
it('should update when a new major nightly version is promoted', async () => {
|
||||
const version = '4.0.0-nightly.19950901';
|
||||
const currentVersion = '3.0.0-nightly.19950828';
|
||||
if (shouldUpdateSupported('nightly', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('4.x.y\n* 3.x.y\n* 2.x.y');
|
||||
});
|
||||
|
||||
it('should not update when a new nightly version is promoted', async () => {
|
||||
const version = '3.0.0-nightly.19950901';
|
||||
const currentVersion = '3.0.0-nightly.19950828';
|
||||
if (shouldUpdateSupported('nightly', currentVersion, version)) {
|
||||
await updateSupported(version, fixtureDir);
|
||||
}
|
||||
const contents = await readFile(fixtureDir, 'utf8');
|
||||
|
||||
expect(contents).to.contain('3.x.y\n* 2.x.y\n* 1.x.y');
|
||||
});
|
||||
});
|
||||
|
||||
// On macOS Circle CI we don't have a real git environment due to running
|
||||
// gclient sync on a linux machine. These tests therefore don't run as expected.
|
||||
ifdescribe(!(process.platform === 'linux' && process.arch === 'arm') && process.platform !== 'darwin')('nextVersion', () => {
|
||||
|
|
Loading…
Reference in a new issue