зеркало из https://github.com/electron/electron.git
build: clean up scripts folder, move release scripts, move zip manifest logic (#18945)
* build: move zip manifest logic in zip_manifests dir * build: remove unused get-version.py script * chore: move all release/sudowoodo related scripts into script/releases * chore: update paths to zip manifests in CI configs * build: fix path to ci release build script for arm tests
This commit is contained in:
Родитель
5686a0713e
Коммит
fb01c94511
|
@ -309,7 +309,7 @@ step-electron-dist-build: &step-electron-dist-build
|
|||
echo "Unknown system: `uname`"
|
||||
exit 1
|
||||
fi
|
||||
electron/script/check-zip-manifest.py out/Default/dist.zip electron/script/dist_zip.$target_os.$target_cpu.manifest
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest
|
||||
fi
|
||||
|
||||
step-electron-dist-store: &step-electron-dist-store
|
||||
|
@ -350,10 +350,10 @@ step-electron-publish: &step-electron-publish
|
|||
cd src/electron
|
||||
if [ "$UPLOAD_TO_S3" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to S3'
|
||||
script/upload.py --upload_to_s3
|
||||
script/release/uploaders/upload.py --upload_to_s3
|
||||
else
|
||||
echo 'Uploading Electron release distribution to Github releases'
|
||||
script/upload.py
|
||||
script/release/uploaders/upload.py
|
||||
fi
|
||||
|
||||
step-persist-data-for-tests: &step-persist-data-for-tests
|
||||
|
@ -521,7 +521,7 @@ step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test
|
|||
if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
|
||||
#Trigger VSTS job, passing along CircleCI job number and branch to build
|
||||
echo "Triggering electron-$TARGET_ARCH-testing build on VSTS"
|
||||
node electron/script/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
|
||||
node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
|
||||
fi
|
||||
|
||||
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
|
||||
|
|
|
@ -18,13 +18,4 @@
|
|||
|
||||
# Releases WG
|
||||
/npm/ @electron/wg-releases
|
||||
/script/release-notes @electron/wg-releases
|
||||
/script/prepare-release.js @electron/wg-releases
|
||||
/script/bump-version.js @electron/wg-releases
|
||||
/script/ci-release-build.js @electron/wg-releases
|
||||
/script/release.js @electron/wg-releases
|
||||
/script/upload-to-github.js @electron/wg-releases
|
||||
/script/release-artifact-cleanup.js @electron/wg-releases
|
||||
/script/get-last-major-for-master.js @electron/wg-releases
|
||||
/script/find-release.js @electron/wg-releases
|
||||
/script/download-circleci-artifacts.js @electron/wg-releases
|
||||
/script/release @electron/wg-releases
|
|
@ -97,7 +97,7 @@ build_script:
|
|||
python electron\script\zip-symbols.py
|
||||
appveyor PushArtifact out/Default/symbols.zip
|
||||
}
|
||||
- python electron/script/check-zip-manifest.py out/Default/dist.zip electron/script/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
||||
|
@ -125,9 +125,9 @@ deploy_script:
|
|||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||
if (Test-Path Env:\UPLOAD_TO_S3) {
|
||||
Write-Output "Uploading Electron release distribution to s3"
|
||||
& python script\upload.py --upload_to_s3
|
||||
& python script\release\uploaders\upload.py --upload_to_s3
|
||||
} else {
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\upload.py
|
||||
& python script\release\uploaders\upload.py
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"asar": "asar",
|
||||
"bump-version": "./script/bump-version.js",
|
||||
"check-tls": "python ./script/tls.py",
|
||||
"clang-format": "find atom/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
|
||||
"generate-version-json": "node script/generate-version-json.js",
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
const { GitProcess } = require('dugite')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
|
||||
async function getLastMajorForMaster () {
|
||||
let branchNames
|
||||
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]-[0-9]-x'], gitDir)
|
||||
if (result.exitCode === 0) {
|
||||
branchNames = result.stdout.trim().split('\n')
|
||||
const filtered = branchNames.map(b => b.replace('origin/', ''))
|
||||
return getNextReleaseBranch(filtered)
|
||||
} else {
|
||||
throw new Error('Release branches could not be fetched.')
|
||||
}
|
||||
}
|
||||
|
||||
function getNextReleaseBranch (branches) {
|
||||
const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0'))
|
||||
return converted.reduce((v1, v2) => semver.gt(v1, v2) ? v1 : v2)
|
||||
}
|
||||
|
||||
module.exports = { getLastMajorForMaster }
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
from lib.util import get_electron_version
|
||||
|
||||
def main():
|
||||
print(get_electron_version())
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -22,6 +22,9 @@ import zipfile
|
|||
from lib.config import is_verbose_mode, PLATFORM
|
||||
from lib.env_util import get_vs_env
|
||||
|
||||
ELECTRON_DIR = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
|
||||
BOTO_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'vendor',
|
||||
'boto'))
|
||||
|
|
|
@ -2,6 +2,8 @@ const { GitProcess } = require('dugite')
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const ELECTRON_DIR = path.resolve(__dirname, '..', '..')
|
||||
const SRC_DIR = path.resolve(ELECTRON_DIR, '..')
|
||||
const OUT_DIR = process.env.ELECTRON_OUT_DIR || 'Debug'
|
||||
|
||||
require('colors')
|
||||
|
@ -22,7 +24,7 @@ function getElectronExec () {
|
|||
}
|
||||
|
||||
function getAbsoluteElectronExec () {
|
||||
return path.resolve(__dirname, '../../..', getElectronExec())
|
||||
return path.resolve(SRC_DIR, getElectronExec())
|
||||
}
|
||||
|
||||
async function handleGitCall (args, gitDir) {
|
||||
|
@ -61,5 +63,7 @@ module.exports = {
|
|||
getCurrentBranch,
|
||||
getElectronExec,
|
||||
getAbsoluteElectronExec,
|
||||
OUT_DIR
|
||||
ELECTRON_DIR,
|
||||
OUT_DIR,
|
||||
SRC_DIR
|
||||
}
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import boto_path_dirs
|
||||
|
|
@ -5,14 +5,13 @@ const minimist = require('minimist')
|
|||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
|
||||
const { ELECTRON_DIR } = require('../../lib/utils')
|
||||
const notesGenerator = require('./notes.js')
|
||||
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const semverify = version => version.replace(/^origin\//, '').replace('x', '0').replace(/-/g, '.')
|
||||
|
||||
const runGit = async (args) => {
|
||||
const response = await GitProcess.exec(args, gitDir)
|
||||
const response = await GitProcess.exec(args, ELECTRON_DIR)
|
||||
if (response.exitCode !== 0) {
|
||||
throw new Error(response.stderr.trim())
|
||||
}
|
|
@ -11,13 +11,14 @@ const octokit = require('@octokit/rest')({
|
|||
})
|
||||
const semver = require('semver')
|
||||
|
||||
const { ELECTRON_VERSION, SRC_DIR } = require('../../lib/utils')
|
||||
|
||||
const MAX_FAIL_COUNT = 3
|
||||
const CHECK_INTERVAL = 5000
|
||||
|
||||
const CACHE_DIR = path.resolve(__dirname, '.cache')
|
||||
const NO_NOTES = 'No notes'
|
||||
const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ]
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const breakTypes = new Set(['breaking-change'])
|
||||
const docTypes = new Set(['doc', 'docs'])
|
||||
|
@ -373,11 +374,11 @@ const getDependencyCommitsGyp = async (pool, fromRef, toRef) => {
|
|||
const repos = [{
|
||||
owner: 'electron',
|
||||
repo: 'libchromiumcontent',
|
||||
dir: path.resolve(gitDir, 'vendor', 'libchromiumcontent')
|
||||
dir: path.resolve(ELECTRON_VERSION, 'vendor', 'libchromiumcontent')
|
||||
}, {
|
||||
owner: 'electron',
|
||||
repo: 'node',
|
||||
dir: path.resolve(gitDir, 'vendor', 'node')
|
||||
dir: path.resolve(ELECTRON_VERSION, 'vendor', 'node')
|
||||
}]
|
||||
|
||||
for (const repo of repos) {
|
||||
|
@ -393,7 +394,7 @@ const getDependencyCommitsGyp = async (pool, fromRef, toRef) => {
|
|||
|
||||
const getDepsVariable = async (ref, key) => {
|
||||
// get a copy of that reference point's DEPS file
|
||||
const deps = await runGit(gitDir, ['show', `${ref}:DEPS`])
|
||||
const deps = await runGit(ELECTRON_VERSION, ['show', `${ref}:DEPS`])
|
||||
const filename = path.resolve(os.tmpdir(), 'DEPS')
|
||||
fs.writeFileSync(filename, deps)
|
||||
|
||||
|
@ -413,7 +414,7 @@ const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
|||
const repos = [{ // just node
|
||||
owner: 'electron',
|
||||
repo: 'node',
|
||||
dir: path.resolve(gitDir, '..', 'third_party', 'electron_node'),
|
||||
dir: path.resolve(SRC_DIR, 'third_party', 'electron_node'),
|
||||
deps_variable_name: 'node_version'
|
||||
}]
|
||||
|
||||
|
@ -429,7 +430,7 @@ const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
|||
// other repos - controller
|
||||
|
||||
const getDependencyCommits = async (pool, from, to) => {
|
||||
const filename = path.resolve(gitDir, 'vendor', 'libchromiumcontent')
|
||||
const filename = path.resolve(ELECTRON_VERSION, 'vendor', 'libchromiumcontent')
|
||||
const useGyp = fs.existsSync(filename)
|
||||
|
||||
return useGyp
|
||||
|
@ -474,7 +475,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
|
|||
}
|
||||
|
||||
// get the electron/electron commits
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: gitDir }
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: ELECTRON_VERSION }
|
||||
await addRepoToPool(pool, electron, fromRef, toRef)
|
||||
|
||||
// Don't include submodules if comparing across major versions;
|
|
@ -13,8 +13,8 @@ const { GitProcess } = require('dugite')
|
|||
|
||||
const path = require('path')
|
||||
const readline = require('readline')
|
||||
const releaseNotesGenerator = require('./release-notes/index.js')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const releaseNotesGenerator = require('./notes/index.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js')
|
||||
const bumpType = args._[0]
|
||||
const targetRepo = bumpType === 'nightly' ? 'nightlies' : 'electron'
|
||||
|
||||
|
@ -28,12 +28,11 @@ if (!bumpType && !args.notesOnly) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
async function getNewVersion (dryRun) {
|
||||
if (!dryRun) {
|
||||
console.log(`Bumping for new "${bumpType}" version.`)
|
||||
}
|
||||
const bumpScript = path.join(__dirname, 'bump-version.js')
|
||||
const bumpScript = path.join(__dirname, 'version-bumper.js')
|
||||
const scriptArgs = ['node', bumpScript, `--bump=${bumpType}`]
|
||||
if (dryRun) scriptArgs.push('--dryRun')
|
||||
try {
|
||||
|
@ -122,7 +121,7 @@ async function createRelease (branchToTarget, isBeta) {
|
|||
}
|
||||
|
||||
async function pushRelease (branch) {
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], gitDir)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], ELECTRON_DIR)
|
||||
if (pushDetails.exitCode === 0) {
|
||||
console.log(`${pass} Successfully pushed the release. Wait for ` +
|
||||
`release builds to finish before running "npm run release".`)
|
||||
|
@ -141,7 +140,7 @@ async function runReleaseBuilds (branch) {
|
|||
|
||||
async function tagRelease (version) {
|
||||
console.log(`Tagging release ${version}.`)
|
||||
const checkoutDetails = await GitProcess.exec([ 'tag', '-a', '-m', version, version ], gitDir)
|
||||
const checkoutDetails = await GitProcess.exec([ 'tag', '-a', '-m', version, version ], ELECTRON_DIR)
|
||||
if (checkoutDetails.exitCode === 0) {
|
||||
console.log(`${pass} Successfully tagged ${version}.`)
|
||||
} else {
|
||||
|
@ -183,7 +182,7 @@ async function promptForVersion (version) {
|
|||
// function to determine if there have been commits to master since the last release
|
||||
async function changesToRelease () {
|
||||
const lastCommitWasRelease = new RegExp(`^Bump v[0-9.]*(-beta[0-9.]*)?(-nightly[0-9.]*)?$`, 'g')
|
||||
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], gitDir)
|
||||
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], ELECTRON_DIR)
|
||||
return !lastCommitWasRelease.test(lastCommit.stdout)
|
||||
}
|
||||
|
||||
|
@ -192,7 +191,7 @@ async function prepareRelease (isBeta, notesOnly) {
|
|||
const newVersion = await getNewVersion(true)
|
||||
console.log(newVersion)
|
||||
} else {
|
||||
const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(gitDir)
|
||||
const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(ELECTRON_DIR)
|
||||
if (notesOnly) {
|
||||
const newVersion = await getNewVersion(true)
|
||||
const releaseNotes = await getReleaseNotes(currentBranch, newVersion)
|
|
@ -2,10 +2,10 @@ const temp = require('temp')
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const childProcess = require('child_process')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils')
|
||||
const request = require('request')
|
||||
const semver = require('semver')
|
||||
const rootPackageJson = require('../package.json')
|
||||
const rootPackageJson = require('../../package.json')
|
||||
const octokit = require('@octokit/rest')({
|
||||
headers: { 'User-Agent': 'electron-npm-publisher' }
|
||||
})
|
||||
|
@ -55,7 +55,7 @@ new Promise((resolve, reject) => {
|
|||
const noThirdSegment = name === 'README.md' || name === 'LICENSE'
|
||||
fs.writeFileSync(
|
||||
path.join(tempDir, name),
|
||||
fs.readFileSync(path.join(__dirname, '..', noThirdSegment ? '' : 'npm', name))
|
||||
fs.readFileSync(path.join(ELECTRON_DIR, noThirdSegment ? '' : 'npm', name))
|
||||
)
|
||||
})
|
||||
// copy from root package.json to temp/package.json
|
|
@ -10,14 +10,13 @@ const args = require('minimist')(process.argv.slice(2), {
|
|||
})
|
||||
const { execSync } = require('child_process')
|
||||
const { GitProcess } = require('dugite')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js')
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
})
|
||||
|
||||
const path = require('path')
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
|
||||
function getLastBumpCommit (tag) {
|
||||
const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString()
|
||||
|
@ -27,8 +26,8 @@ function getLastBumpCommit (tag) {
|
|||
async function revertBumpCommit (tag) {
|
||||
const branch = await getCurrentBranch()
|
||||
const commitToRevert = getLastBumpCommit(tag).hash
|
||||
await GitProcess.exec(['revert', commitToRevert], gitDir)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], gitDir)
|
||||
await GitProcess.exec(['revert', commitToRevert], ELECTRON_DIR)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], ELECTRON_DIR)
|
||||
if (pushDetails.exitCode === 0) {
|
||||
console.log(`${pass} successfully reverted release commit.`)
|
||||
} else {
|
|
@ -15,7 +15,7 @@ const fs = require('fs')
|
|||
const { execSync } = require('child_process')
|
||||
const nugget = require('nugget')
|
||||
const got = require('got')
|
||||
const pkg = require('../package.json')
|
||||
const pkg = require('../../package.json')
|
||||
const pkgVersion = `v${pkg.version}`
|
||||
const pass = '\u2713'.green
|
||||
const path = require('path')
|
||||
|
@ -24,6 +24,8 @@ const sumchecker = require('sumchecker')
|
|||
const temp = require('temp').track()
|
||||
const { URL } = require('url')
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils')
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
})
|
||||
|
@ -146,20 +148,6 @@ function s3UrlsForVersion (version) {
|
|||
return patterns
|
||||
}
|
||||
|
||||
function checkVersion () {
|
||||
if (args.skipVersionCheck) return
|
||||
|
||||
console.log(`Verifying that app version matches package version ${pkgVersion}.`)
|
||||
const startScript = path.join(__dirname, 'start.py')
|
||||
const scriptArgs = ['--version']
|
||||
if (args.automaticRelease) {
|
||||
scriptArgs.unshift('-R')
|
||||
}
|
||||
const appVersion = runScript(startScript, scriptArgs).trim()
|
||||
check((pkgVersion.indexOf(appVersion) === 0), `App version ${appVersion} matches ` +
|
||||
`package version ${pkgVersion}.`, true)
|
||||
}
|
||||
|
||||
function runScript (scriptName, scriptArgs, cwd) {
|
||||
const scriptCommand = `${scriptName} ${scriptArgs.join(' ')}`
|
||||
const scriptOptions = {
|
||||
|
@ -176,14 +164,14 @@ function runScript (scriptName, scriptArgs, cwd) {
|
|||
|
||||
function uploadNodeShasums () {
|
||||
console.log('Uploading Node SHASUMS file to S3.')
|
||||
const scriptPath = path.join(__dirname, 'upload-node-checksums.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-node-checksums.py')
|
||||
runScript(scriptPath, ['-v', pkgVersion])
|
||||
console.log(`${pass} Done uploading Node SHASUMS file to S3.`)
|
||||
}
|
||||
|
||||
function uploadIndexJson () {
|
||||
console.log('Uploading index.json to S3.')
|
||||
const scriptPath = path.join(__dirname, 'upload-index-json.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-index-json.py')
|
||||
runScript(scriptPath, [pkgVersion])
|
||||
console.log(`${pass} Done uploading index.json to S3.`)
|
||||
}
|
||||
|
@ -202,7 +190,7 @@ async function createReleaseShasums (release) {
|
|||
})
|
||||
}
|
||||
console.log(`Creating and uploading the release ${fileName}.`)
|
||||
const scriptPath = path.join(__dirname, 'merge-electron-checksums.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'merge-electron-checksums.py')
|
||||
const checksums = runScript(scriptPath, ['-v', pkgVersion])
|
||||
|
||||
console.log(`${pass} Generated release SHASUMS.`)
|
||||
|
@ -274,7 +262,6 @@ async function makeRelease (releaseToValidate) {
|
|||
const release = await getDraftRelease(releaseToValidate)
|
||||
await validateReleaseAssets(release, true)
|
||||
} else {
|
||||
checkVersion()
|
||||
let draftRelease = await getDraftRelease()
|
||||
uploadNodeShasums()
|
||||
uploadIndexJson()
|
|
@ -6,10 +6,11 @@ import os
|
|||
import sys
|
||||
import urllib2
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = get_out_dir()
|
||||
|
||||
BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='
|
||||
|
@ -48,7 +49,7 @@ def main():
|
|||
if not authToken or authToken == "":
|
||||
raise Exception("Please set META_DUMPER_AUTH_HEADER")
|
||||
# Upload the index.json.
|
||||
with scoped_cwd(SOURCE_ROOT):
|
||||
with scoped_cwd(ELECTRON_DIR):
|
||||
safe_mkdir(OUT_DIR)
|
||||
index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json'))
|
||||
|
|
@ -7,6 +7,8 @@ import shutil
|
|||
import sys
|
||||
import tempfile
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import download, rm_rf, s3put, safe_mkdir
|
||||
|
|
@ -6,10 +6,11 @@ import os
|
|||
import shutil
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import PLATFORM, get_target_arch, s3_config
|
||||
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DIST_DIR = get_dist_dir()
|
||||
OUT_DIR = get_out_dir()
|
||||
GEN_DIR = os.path.join(OUT_DIR, 'gen')
|
|
@ -4,11 +4,12 @@ import os
|
|||
import glob
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import PLATFORM, s3_config, enable_verbose_mode
|
||||
from lib.util import get_electron_branding, execute, rm_rf, safe_mkdir, s3put, \
|
||||
get_out_dir
|
||||
get_out_dir, ELECTRON_DIR
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
RELEASE_DIR = get_out_dir()
|
||||
|
||||
|
||||
|
@ -22,7 +23,7 @@ PDB_LIST = [
|
|||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
os.chdir(ELECTRON_DIR)
|
||||
if PLATFORM == 'win32':
|
||||
for pdb in PDB_LIST:
|
||||
run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
|
|
@ -12,12 +12,14 @@ import subprocess
|
|||
import sys
|
||||
import tempfile
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from io import StringIO
|
||||
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
|
||||
get_zip_name
|
||||
from lib.util import get_electron_branding, execute, get_electron_version, \
|
||||
scoped_cwd, s3put, get_electron_exec, \
|
||||
get_out_dir, SRC_DIR
|
||||
get_out_dir, SRC_DIR, ELECTRON_DIR
|
||||
|
||||
|
||||
ELECTRON_REPO = 'electron/electron'
|
||||
|
@ -26,7 +28,6 @@ ELECTRON_VERSION = get_electron_version()
|
|||
PROJECT_NAME = get_electron_branding()['project_name']
|
||||
PRODUCT_NAME = get_electron_branding()['product_name']
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = get_out_dir()
|
||||
|
||||
DIST_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION)
|
||||
|
@ -69,10 +70,10 @@ def main():
|
|||
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
|
||||
upload_electron(release, symbols_zip, args)
|
||||
if PLATFORM == 'darwin':
|
||||
api_path = os.path.join(SOURCE_ROOT, 'electron-api.json')
|
||||
api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
|
||||
upload_electron(release, api_path, args)
|
||||
|
||||
ts_defs_path = os.path.join(SOURCE_ROOT, 'electron.d.ts')
|
||||
ts_defs_path = os.path.join(ELECTRON_DIR, 'electron.d.ts')
|
||||
upload_electron(release, ts_defs_path, args)
|
||||
dsym_zip = os.path.join(OUT_DIR, DSYM_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip)
|
||||
|
@ -106,9 +107,9 @@ def main():
|
|||
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_script('upload-symbols.py')
|
||||
run_python_upload_script('upload-symbols.py')
|
||||
if PLATFORM == 'win32':
|
||||
run_python_script('upload-node-headers.py', '-v', args.version)
|
||||
run_python_upload_script('upload-node-headers.py', '-v', args.version)
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -130,8 +131,9 @@ def parse_args():
|
|||
return parser.parse_args()
|
||||
|
||||
|
||||
def run_python_script(script, *args):
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', script)
|
||||
def run_python_upload_script(script, *args):
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'uploaders', script)
|
||||
return execute([sys.executable, script_path] + list(args))
|
||||
|
||||
|
||||
|
@ -168,7 +170,8 @@ def upload_electron(release, file_path, args):
|
|||
def upload_io_to_github(release, filename, filepath, version):
|
||||
print('Uploading %s to Github' % \
|
||||
(filename))
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', 'upload-to-github.js')
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-to-github.js')
|
||||
execute(['node', script_path, filepath, filename, str(release['id']),
|
||||
version])
|
||||
|
||||
|
@ -198,7 +201,8 @@ def auth_token():
|
|||
|
||||
|
||||
def get_release(version):
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', 'find-release.js')
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'find-github-release.js')
|
||||
release_info = execute(['node', script_path, version])
|
||||
release = json.loads(release_info)
|
||||
return release
|
|
@ -1,13 +1,15 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { GitProcess } = require('dugite')
|
||||
const utils = require('./lib/version-utils')
|
||||
const 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 writeFile = promisify(fs.writeFile)
|
||||
const readFile = promisify(fs.readFile)
|
||||
|
||||
|
@ -35,7 +37,7 @@ function parseCommandLine () {
|
|||
// run the script
|
||||
async function main () {
|
||||
const opts = parseCommandLine()
|
||||
const currentVersion = await utils.getElectronVersion()
|
||||
const currentVersion = await versionUtils.getElectronVersion()
|
||||
const version = await nextVersion(opts.bump, currentVersion)
|
||||
|
||||
const parsed = semver.parse(version)
|
||||
|
@ -67,13 +69,13 @@ async function main () {
|
|||
|
||||
// get next version for release based on [nightly, beta, stable]
|
||||
async function nextVersion (bumpType, version) {
|
||||
if (utils.isNightly(version) || utils.isBeta(version)) {
|
||||
if (versionUtils.isNightly(version) || versionUtils.isBeta(version)) {
|
||||
switch (bumpType) {
|
||||
case 'nightly':
|
||||
version = await utils.nextNightly(version)
|
||||
version = await versionUtils.nextNightly(version)
|
||||
break
|
||||
case 'beta':
|
||||
version = await utils.nextBeta(version)
|
||||
version = await versionUtils.nextBeta(version)
|
||||
break
|
||||
case 'stable':
|
||||
version = semver.valid(semver.coerce(version))
|
||||
|
@ -81,10 +83,10 @@ async function nextVersion (bumpType, version) {
|
|||
default:
|
||||
throw new Error('Invalid bump type.')
|
||||
}
|
||||
} else if (utils.isStable(version)) {
|
||||
} else if (versionUtils.isStable(version)) {
|
||||
switch (bumpType) {
|
||||
case 'nightly':
|
||||
version = utils.nextNightly(version)
|
||||
version = versionUtils.nextNightly(version)
|
||||
break
|
||||
case 'beta':
|
||||
throw new Error('Cannot bump to beta from stable.')
|
||||
|
@ -102,39 +104,36 @@ async function nextVersion (bumpType, version) {
|
|||
|
||||
// update VERSION file with latest release info
|
||||
async function updateVersion (version) {
|
||||
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
|
||||
const versionPath = path.resolve(ELECTRON_DIR, 'ELECTRON_VERSION')
|
||||
await writeFile(versionPath, version, 'utf8')
|
||||
}
|
||||
|
||||
// update package metadata files with new version
|
||||
async function updatePackageJSON (version) {
|
||||
['package.json'].forEach(async fileName => {
|
||||
const filePath = path.resolve(__dirname, '..', fileName)
|
||||
const file = require(filePath)
|
||||
file.version = version
|
||||
await writeFile(filePath, JSON.stringify(file, null, 2))
|
||||
})
|
||||
const filePath = path.resolve(ELECTRON_DIR, 'package.json')
|
||||
const file = require(filePath)
|
||||
file.version = version
|
||||
await writeFile(filePath, JSON.stringify(file, null, 2))
|
||||
}
|
||||
|
||||
// push bump commit to release branch
|
||||
async function commitVersionBump (version) {
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
|
||||
await GitProcess.exec(gitArgs, gitDir)
|
||||
await GitProcess.exec(gitArgs, ELECTRON_DIR)
|
||||
}
|
||||
|
||||
// updates atom.rc file with new semver values
|
||||
async function updateWinRC (components) {
|
||||
const filePath = path.resolve(__dirname, '..', 'shell', 'browser', 'resources', 'win', 'atom.rc')
|
||||
const filePath = path.resolve(ELECTRON_DIR, 'shell', 'browser', 'resources', 'win', 'atom.rc')
|
||||
const data = await readFile(filePath, 'utf8')
|
||||
const arr = data.split('\n')
|
||||
arr.forEach((line, idx) => {
|
||||
if (line.includes('FILEVERSION')) {
|
||||
arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}`
|
||||
arr[idx] = ` FILEVERSION ${versionUtils.makeVersion(components, ',', versionUtils.preType.PARTIAL)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${versionUtils.makeVersion(components, ',', versionUtils.preType.PARTIAL)}`
|
||||
} else if (line.includes('FileVersion')) {
|
||||
arr[idx] = ` VALUE "FileVersion", "${utils.makeVersion(components, '.')}"`
|
||||
arr[idx + 5] = ` VALUE "ProductVersion", "${utils.makeVersion(components, '.')}"`
|
||||
arr[idx] = ` VALUE "FileVersion", "${versionUtils.makeVersion(components, '.')}"`
|
||||
arr[idx + 5] = ` VALUE "ProductVersion", "${versionUtils.makeVersion(components, '.')}"`
|
||||
}
|
||||
})
|
||||
await writeFile(filePath, arr.join('\n'))
|
|
@ -1,12 +1,12 @@
|
|||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const semver = require('semver')
|
||||
const { getLastMajorForMaster } = require('../get-last-major-for-master')
|
||||
const { GitProcess } = require('dugite')
|
||||
const { promisify } = require('util')
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils')
|
||||
|
||||
const readFile = promisify(fs.readFile)
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const preType = {
|
||||
NONE: 'none',
|
||||
|
@ -42,7 +42,7 @@ const makeVersion = (components, delim, pre = preType.NONE) => {
|
|||
async function nextBeta (v) {
|
||||
const next = semver.coerce(semver.clean(v))
|
||||
|
||||
const tagBlob = await GitProcess.exec(['tag', '--list', '-l', `v${next}-beta.*`], gitDir)
|
||||
const tagBlob = await GitProcess.exec(['tag', '--list', '-l', `v${next}-beta.*`], ELECTRON_DIR)
|
||||
const tags = tagBlob.stdout.split('\n').filter(e => e !== '')
|
||||
tags.sort((t1, t2) => semver.gt(t1, t2))
|
||||
|
||||
|
@ -51,7 +51,7 @@ async function nextBeta (v) {
|
|||
}
|
||||
|
||||
async function getElectronVersion () {
|
||||
const versionPath = path.join(__dirname, '..', '..', 'ELECTRON_VERSION')
|
||||
const versionPath = path.resolve(ELECTRON_DIR, 'ELECTRON_VERSION')
|
||||
const version = await readFile(versionPath, 'utf8')
|
||||
return version.trim()
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ async function nextNightly (v) {
|
|||
let next = semver.valid(semver.coerce(v))
|
||||
const pre = `nightly.${getCurrentDate()}`
|
||||
|
||||
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], gitDir)).stdout.trim()
|
||||
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim()
|
||||
if (branch === 'master') {
|
||||
next = semver.inc(await getLastMajorForMaster(), 'major')
|
||||
} else if (isStable(v)) {
|
||||
|
@ -70,6 +70,23 @@ async function nextNightly (v) {
|
|||
return `${next}-${pre}`
|
||||
}
|
||||
|
||||
async function getLastMajorForMaster () {
|
||||
let branchNames
|
||||
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]-[0-9]-x'], ELECTRON_DIR)
|
||||
if (result.exitCode === 0) {
|
||||
branchNames = result.stdout.trim().split('\n')
|
||||
const filtered = branchNames.map(b => b.replace('origin/', ''))
|
||||
return getNextReleaseBranch(filtered)
|
||||
} else {
|
||||
throw new Error('Release branches could not be fetched.')
|
||||
}
|
||||
}
|
||||
|
||||
function getNextReleaseBranch (branches) {
|
||||
const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0'))
|
||||
return converted.reduce((v1, v2) => semver.gt(v1, v2) ? v1 : v2)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isStable,
|
||||
isBeta,
|
|
@ -1,7 +1,7 @@
|
|||
const { expect } = require('chai')
|
||||
const { remote } = require('electron')
|
||||
const { nextVersion } = require('../script/bump-version')
|
||||
const utils = require('../script/lib/version-utils')
|
||||
const { nextVersion } = require('../script/release/version-bumper')
|
||||
const utils = require('../script/release/version-utils')
|
||||
|
||||
const isCi = remote.getGlobal('isCi')
|
||||
|
||||
|
@ -9,7 +9,7 @@ const isCi = remote.getGlobal('isCi')
|
|||
// gclient sync on a linux machine. These tests therefore don't run as expected
|
||||
const describeFn = (isCi && process.platform === 'darwin') ? describe.skip : describe
|
||||
|
||||
describeFn('bump-version utils', () => {
|
||||
describeFn('version-bumper', () => {
|
||||
it('makes a version with a period delimeter', () => {
|
||||
const components = {
|
||||
major: 2,
|
||||
|
@ -46,7 +46,7 @@ describeFn('bump-version utils', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describeFn('bump-version script', () => {
|
||||
describeFn('version-bumper script', () => {
|
||||
const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g
|
||||
const betaPattern = /[0-9.]*(-beta[0-9.]*)/g
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче