Skip to content

Commit 2a0260d

Browse files
authored
Merge pull request #36 from atom-ide-community/vsts-config-atom-ide-community-org
2 parents e9b58e4 + 9551fa5 commit 2a0260d

File tree

6 files changed

+44
-15
lines changed

6 files changed

+44
-15
lines changed

script/vsts/get-release-version.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const request = require('request-promise-native');
44
const repositoryRootPath = path.resolve(__dirname, '..', '..');
55
const appMetadata = require(path.join(repositoryRootPath, 'package.json'));
66

7+
const REPO_OWNER = process.env.REPO_OWNER;
8+
const NIGHTLY_RELEASE_REPO = process.env.NIGHTLY_RELEASE_REPO;
9+
710
const yargs = require('yargs');
811
const argv = yargs
912
.usage('Usage: $0 [options]')
@@ -26,7 +29,7 @@ async function getReleaseVersion() {
2629
let releaseVersion = process.env.ATOM_RELEASE_VERSION || appMetadata.version;
2730
if (argv.nightly) {
2831
const releases = await request({
29-
url: 'https://api.github.com/repos/atom/atom-nightly-releases/releases',
32+
url: `https://api.github.com/repos/${REPO_OWNER}/${NIGHTLY_RELEASE_REPO}/releases`,
3033
headers: {
3134
Accept: 'application/vnd.github.v3+json',
3235
'User-Agent': 'Atom Release Build'

script/vsts/lib/release-notes.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ const octokit = require('@octokit/rest')();
33
const changelog = require('pr-changelog');
44
const childProcess = require('child_process');
55

6+
const REPO_OWNER = process.env.REPO_OWNER;
7+
const MAIN_REPO = process.env.MAIN_REPO;
8+
const NIGHTLY_RELEASE_REPO = process.env.NIGHTLY_RELEASE_REPO;
9+
610
module.exports.getRelease = async function(releaseVersion, githubToken) {
711
if (githubToken) {
812
octokit.authenticate({
@@ -12,8 +16,8 @@ module.exports.getRelease = async function(releaseVersion, githubToken) {
1216
}
1317

1418
const releases = await octokit.repos.getReleases({
15-
owner: 'atom',
16-
repo: 'atom'
19+
owner: REPO_OWNER,
20+
repo: MAIN_REPO
1721
});
1822
const release = releases.data.find(r => semver.eq(r.name, releaseVersion));
1923

@@ -49,16 +53,16 @@ module.exports.generateForVersion = async function(
4953
oldVersionName = `v${parsedVersion.major}.${parsedVersion.minor - 1}.0`;
5054
} else {
5155
let releases = await octokit.repos.getReleases({
52-
owner: 'atom',
53-
repo: 'atom'
56+
owner: REPO_OWNER,
57+
repo: MAIN_REPO
5458
});
5559
oldVersion = 'v' + getPreviousRelease(releaseVersion, releases.data).name;
5660
oldVersionName = oldVersion;
5761
}
5862

5963
const allChangesText = await changelog.getChangelog({
60-
owner: 'atom',
61-
repo: 'atom',
64+
owner: REPO_OWNER,
65+
repo: MAIN_REPO,
6266
fromTag: oldVersion,
6367
toTag: newVersionBranch,
6468
dependencyKey: 'packageDependencies',
@@ -71,7 +75,7 @@ module.exports.generateForVersion = async function(
7175
}) {
7276
let prString = changelog.pullRequestsToString(pullRequests);
7377
let title = repo;
74-
if (repo === 'atom') {
78+
if (repo === MAIN_REPO) {
7579
title = 'Atom Core';
7680
fromTag = oldVersionName;
7781
toTag = releaseVersion;
@@ -110,13 +114,13 @@ module.exports.generateForNightly = async function(
110114

111115
const latestCommit = latestCommitResult.stdout.toString().trim();
112116
const output = [
113-
`### This nightly release is based on https://github.com/atom/atom/commit/${latestCommit} :atom: :night_with_stars:`
117+
`### This nightly release is based on https://github.com/${REPO_OWNER}/${MAIN_REPO}/commit/${latestCommit} :atom: :night_with_stars:`
114118
];
115119

116120
try {
117121
const releases = await octokit.repos.getReleases({
118-
owner: 'atom',
119-
repo: 'atom-nightly-releases'
122+
owner: REPO_OWNER,
123+
repo: NIGHTLY_RELEASE_REPO
120124
});
121125

122126
const previousRelease = getPreviousRelease(releaseVersion, releases.data);
@@ -139,7 +143,7 @@ module.exports.generateForNightly = async function(
139143
output.push('No changes have been included in this release');
140144
} else {
141145
output.push(
142-
`Click [here](https://github.com/atom/atom/compare/${previousCommit}...${latestCommit}) to see the changes included with this release!`
146+
`Click [here](https://github.com/${REPO_OWNER}/${MAIN_REPO}/compare/${previousCommit}...${latestCommit}) to see the changes included with this release!`
143147
);
144148
}
145149
}

script/vsts/nightly-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
displayName: npm install
1212
- script: node script\vsts\get-release-version.js --nightly
1313
name: Version
14+
env:
15+
REPO_OWNER: $(REPO_OWNER)
16+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
1417

1518
# Import OS-specific build definitions
1619
- template: platforms/windows.yml
@@ -59,6 +62,9 @@ jobs:
5962
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
6063
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
6164
PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY)
65+
REPO_OWNER: $(REPO_OWNER)
66+
MAIN_REPO: $(MAIN_REPO)
67+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
6268
displayName: Create Nightly Release
6369
- job: bump_dependencies
6470
displayName: Bump Dependencies

script/vsts/pull-requests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
displayName: npm install
1414
- script: node script\vsts\get-release-version.js
1515
name: Version
16+
env:
17+
REPO_OWNER: $(REPO_OWNER)
18+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
1619

1720
# Import OS-specific build definitions
1821
- template: platforms/windows.yml

script/vsts/release-branch-build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
displayName: npm install
1818
- script: node script\vsts\get-release-version.js
1919
name: Version
20+
env:
21+
REPO_OWNER: $(REPO_OWNER)
22+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
2023

2124
# Import OS-specific build definitions.
2225
- template: platforms/windows.yml
@@ -68,6 +71,9 @@ jobs:
6871
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
6972
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
7073
PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY)
74+
REPO_OWNER: $(REPO_OWNER)
75+
MAIN_REPO: $(MAIN_REPO)
76+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
7177
displayName: Create Draft Release
7278
condition: and(succeeded(), eq(variables['Atom.AutoDraftRelease'], 'true'), eq(variables['IsReleaseBranch'], 'true'))
7379
@@ -78,5 +84,8 @@ jobs:
7884
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
7985
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
8086
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
87+
REPO_OWNER: $(REPO_OWNER)
88+
MAIN_REPO: $(MAIN_REPO)
89+
NIGHTLY_RELEASE_REPO: $(NIGHTLY_RELEASE_REPO)
8190
displayName: Upload CI Artifacts to S3
8291
condition: and(succeeded(), eq(variables['IsSignedZipBranch'], 'true'))

script/vsts/upload-artifacts.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const uploadLinuxPackages = require('./lib/upload-linux-packages');
1212

1313
const CONFIG = require('../config');
1414

15+
const REPO_OWNER = process.env.REPO_OWNER;
16+
const MAIN_REPO = process.env.MAIN_REPO;
17+
const NIGHTLY_RELEASE_REPO = process.env.NIGHTLY_RELEASE_REPO;
18+
1519
const yargs = require('yargs');
1620
const argv = yargs
1721
.usage('Usage: $0 [options]')
@@ -127,13 +131,13 @@ async function uploadArtifacts() {
127131
? spawnSync('git', ['rev-parse', 'HEAD'])
128132
.stdout.toString()
129133
.trimEnd()
130-
: 'master'; // Nightly tags are created in atom/atom-nightly-releases so the SHA is irrelevant
134+
: 'master'; // Nightly tags are created in REPO_OWNER/NIGHTLY_RELEASE_REPO so the SHA is irrelevant
131135

132136
console.log(`Creating GitHub release v${releaseVersion}`);
133137
const release = await publishReleaseAsync({
134138
token: process.env.GITHUB_TOKEN,
135-
owner: 'atom',
136-
repo: !isNightlyRelease ? 'atom' : 'atom-nightly-releases',
139+
owner: REPO_OWNER,
140+
repo: !isNightlyRelease ? MAIN_REPO : NIGHTLY_RELEASE_REPO,
137141
name: CONFIG.computedAppVersion,
138142
notes: newReleaseNotes,
139143
target_commitish: releaseSha,

0 commit comments

Comments
 (0)