Merge pull request #19346 from atom/dw-fix-draft-automation

Re-enable draft release automation for builds on release branches
This commit is contained in:
Jason Rudolph 2019-05-21 14:27:38 -04:00 committed by GitHub
commit 0ab0e6595d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 13 deletions

View File

@ -62,19 +62,17 @@ jobs:
downloadType: 'specific' downloadType: 'specific'
displayName: Download Release Artifacts displayName: Download Release Artifacts
# NOTE: This has been disabled until one final issue has been resolved - script: |
# around setting the SHA on GitHub releases. node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging"
# - script: | env:
# node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging" GITHUB_TOKEN: $(GITHUB_TOKEN)
# env: ATOM_RELEASE_VERSION: $(ReleaseVersion)
# GITHUB_TOKEN: $(GITHUB_TOKEN) ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
# ATOM_RELEASE_VERSION: $(ReleaseVersion) ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
# ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
# ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY)
# ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) displayName: Create Draft Release
# PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY) condition: and(succeeded(), eq(variables['Atom.AutoDraftRelease'], 'true'), eq(variables['IsReleaseBranch'], 'true'))
# displayName: Create Draft Release
# condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'))
- script: | - script: |
node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/" node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/"

View File

@ -4,6 +4,7 @@ const fs = require('fs')
const os = require('os') const os = require('os')
const path = require('path') const path = require('path')
const glob = require('glob') const glob = require('glob')
const spawnSync = require('../lib/spawn-sync')
const publishRelease = require('publish-release') const publishRelease = require('publish-release')
const releaseNotes = require('./lib/release-notes') const releaseNotes = require('./lib/release-notes')
const uploadToS3 = require('./lib/upload-to-s3') const uploadToS3 = require('./lib/upload-to-s3')
@ -93,6 +94,11 @@ async function uploadArtifacts () {
console.log(`New release notes:\n\n${newReleaseNotes}`) console.log(`New release notes:\n\n${newReleaseNotes}`)
const releaseSha =
!isNightlyRelease
? spawnSync('git', ['rev-parse', 'HEAD']).stdout.toString().trimEnd()
: 'master' // Nightly tags are created in atom/atom-nightly-releases so the SHA is irrelevant
console.log(`Creating GitHub release v${releaseVersion}`) console.log(`Creating GitHub release v${releaseVersion}`)
const release = const release =
await publishReleaseAsync({ await publishReleaseAsync({
@ -101,6 +107,7 @@ async function uploadArtifacts () {
repo: !isNightlyRelease ? 'atom' : 'atom-nightly-releases', repo: !isNightlyRelease ? 'atom' : 'atom-nightly-releases',
name: CONFIG.computedAppVersion, name: CONFIG.computedAppVersion,
notes: newReleaseNotes, notes: newReleaseNotes,
target_commitish: releaseSha,
tag: `v${CONFIG.computedAppVersion}`, tag: `v${CONFIG.computedAppVersion}`,
draft: !isNightlyRelease, draft: !isNightlyRelease,
prerelease: CONFIG.channel !== 'stable', prerelease: CONFIG.channel !== 'stable',