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

Implement RFC 002: Atom Nightly Releases #17538

Merged
merged 30 commits into from Jul 11, 2018
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
34e37f3
Enable automated nightly Atom releases
daviwil Jun 19, 2018
882648c
Replace app icons
simurai Jun 22, 2018
9388a78
Simplify channel name detection
daviwil Jun 23, 2018
a5a8727
Upload release assets to S3 in script/publish-release
daviwil Jun 23, 2018
ed48f2d
Generate nightly build version from package.json
daviwil Jun 26, 2018
9669a9b
Update app title and file paths to use channel name
daviwil Jun 26, 2018
d54bb62
Update atom.sh to support the nightly channel
daviwil Jun 26, 2018
691d5da
Command installer should use known channel names
daviwil Jun 27, 2018
bd5d258
Detect any channel name in AtomEnvironment.getReleaseChannel
daviwil Jun 27, 2018
ff0cd4c
Use atom.io update endpoint for Windows installer builds
daviwil Jun 28, 2018
067bd1a
Temporarily disable Atom tests on VSTS
daviwil Jun 19, 2018
8e3d1f4
Use Node.js 8.9.3 in VSTS builds
daviwil Jun 25, 2018
cd83486
Fix isReleasedVersion check in AtomEnvironment
daviwil Jun 28, 2018
0d6b5d9
Fix CommandInstaller tests
daviwil Jun 29, 2018
0c364d0
Don't change Atom app name on dev channel
daviwil Jun 29, 2018
ec2abbb
Possible fix for FileRecoveryService test on Linux
daviwil Jun 30, 2018
5634a64
Re-enable Windows and Linux tests on VSTS
daviwil Jun 30, 2018
9858800
Mock fs.createWriteStream to fix FileRecoveryService test
daviwil Jun 30, 2018
7750b8c
Re-enable macOS VSTS CI tests
daviwil Jul 2, 2018
5917800
Add CI_PROVIDER env variable to test tasks
daviwil Jul 6, 2018
4527a44
Merge branch 'master' into dw-nightly-releases
daviwil Jul 6, 2018
f1c7ddf
:fire: script/lib/create-github-release.js
daviwil Jul 6, 2018
e91030f
Set timeout of 180 minutes on nightly build
daviwil Jul 7, 2018
0d0db81
Remove queue setting in nightly build
daviwil Jul 7, 2018
49b9b9e
Write error to stderr if publishing release fails
daviwil Jul 9, 2018
7b711cd
Add documentation for Atom Nightly build process
daviwil Jul 9, 2018
fa326a0
Minor tweaks to build documentation
daviwil Jul 9, 2018
bea3267
Simplify atom-x64 nupkg path generation
daviwil Jul 9, 2018
3046f68
Try possible fix for broken GitHub package tests
daviwil Jul 10, 2018
3109958
Revert "Try possible fix for broken GitHub package tests"
daviwil Jul 11, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+93 −20
Diff settings

Always

Just for now

Upload release assets to S3 in script/publish-release

  • Loading branch information...
daviwil committed Jun 23, 2018
commit a5a8727b0b08787ff631bf7ebd9ff6da63926b8f
Copy path View file
@@ -0,0 +1,57 @@
'use strict'

const fs = require('fs')
const path = require('path')
const aws = require('aws-sdk')

module.exports = function (s3Key, s3Secret, s3Bucket, directory, assets) {
const s3 = new aws.S3({
accessKeyId: s3Key,
secretAccessKey: s3Secret,
params: { Bucket: s3Bucket }
})

function listExistingAssetsForDirectory (directory) {
return s3.listObjectsV2({ Prefix: directory }).promise().then((res) => {
return res.Contents.map((obj) => { return { Key: obj.Key } })
})
}

function deleteExistingAssets (existingAssets) {
if (existingAssets.length > 0) {
return s3.deleteObjects({ Delete: { Objects: existingAssets } }).promise()
} else {
return Promise.resolve(true)
}
}

function uploadAssets (assets, directory) {
return assets.reduce(
function (promise, asset) {
return promise.then(() => uploadAsset(directory, asset))
}, Promise.resolve())
}

function uploadAsset (directory, assetPath) {
return new Promise((resolve, reject) => {
console.info(`Uploading ${assetPath}`)
const params = {
Key: `${directory}${path.basename(assetPath)}`,
ACL: 'public-read',
Body: fs.createReadStream(assetPath)
}

s3.upload(params, error => {
if (error) {
reject(error)
} else {
resolve()
}
})
})
}

return listExistingAssetsForDirectory(directory)
.then(deleteExistingAssets)
.then(() => uploadAssets(assets, directory))
}
Copy path View file
@@ -4,6 +4,7 @@
"dependencies": {
"7zip-bin": "^4.0.2",
"async": "2.0.1",
"aws-sdk": "^2.5.2",
"babel-core": "5.8.38",
"coffeelint": "1.15.7",
"colors": "1.1.2",
Copy path View file
@@ -5,10 +5,9 @@
const path = require('path')
const glob = require('glob')
const publishRelease = require('publish-release')
const uploadToS3 = require('./lib/upload-to-s3')
const CONFIG = require('./config')

console.log(`Publishing GitHub release ${CONFIG.computedAppVersion}`)

const yargs = require('yargs')
const argv = yargs
.usage('Usage: $0 [options]')
@@ -20,21 +19,34 @@ const argv = yargs
let assetsPath = argv.assetsPath || path.join(CONFIG.repositoryRootPath, 'out')
let assets = glob.sync(path.join(assetsPath, '*(*.exe|*.zip|*.nupkg|*.tar.gz|*.rpm|*.deb|RELEASES*)'))

publishRelease({
token: process.env.GITHUB_TOKEN,
owner: 'atom',
repo: CONFIG.channel !== 'nightly' ? 'atom' : 'atom-nightly-releases',
name: CONFIG.computedAppVersion,
tag: CONFIG.computedAppVersion,
draft: false,
prerelease: CONFIG.channel !== 'stable',
reuseRelease: true,
skipIfPublished: true,
assets
}, function (err, release) {
if (err) {
console.log("An error occurred while publishing the release:\n\n", err)
} else {
console.log("Release published successfully: ", release.html_url)
}
})
console.log(`Uploading release assets for ${CONFIG.computedAppVersion} to S3`)

uploadToS3(
process.env.ATOM_RELEASES_S3_KEY,
process.env.ATOM_RELEASES_S3_SECRET,
process.env.ATOM_RELEASES_S3_BUCKET,
`releases/v${CONFIG.computedAppVersion}/`,
assets).then(
() => {
console.log(`Publishing GitHub release ${CONFIG.computedAppVersion}`)
publishRelease({
token: process.env.GITHUB_TOKEN,
owner: 'atom',
repo: CONFIG.channel !== 'nightly' ? 'atom' : 'atom-nightly-releases',
name: CONFIG.computedAppVersion,
tag: `v${CONFIG.computedAppVersion}`,
draft: false,
prerelease: CONFIG.channel !== 'stable',
reuseRelease: true,
skipIfPublished: true,
assets
}, function (err, release) {
if (err) {
console.log("An error occurred while publishing the release:\n\n", err)
} else {
console.log("Release published successfully: ", release.html_url)
}
})
}).catch((err) => {
console.error('An error occurred while uploading the release:', err)
})
@@ -36,4 +36,7 @@ phases:
$(Build.SourcesDirectory)\script\publish-release.cmd --assets-path "$(System.ArtifactsDirectory)/Binaries"
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
displayName: Create Nightly Release
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.