(tag)
| 19 | assert(BLUEPRINT === 'app' || BLUEPRINT === 'addon', 'BLUEPRINT must be set to either `app` or `addon`'); |
| 20 | |
| 21 | async function updateRepo(tag) { |
| 22 | let repoName = APP_REPO; |
| 23 | let command = 'new'; |
| 24 | let name = 'my-app'; |
| 25 | |
| 26 | if (BLUEPRINT === 'addon') { |
| 27 | repoName = ADDON_REPO; |
| 28 | command = 'addon'; |
| 29 | name = 'my-addon'; |
| 30 | } |
| 31 | |
| 32 | let version = tag.replace(/^v/, '').replace(/-ember-cli$/, ''); |
| 33 | let latestEC = await latestVersion('ember-cli'); |
| 34 | let latestECBeta = await latestVersion('ember-cli', { version: 'beta' }); |
| 35 | |
| 36 | let isLatest = version === latestEC; |
| 37 | let isLatestBeta = version === latestECBeta; |
| 38 | |
| 39 | let isStable = !tag.includes('-beta'); |
| 40 | |
| 41 | let outputRepoBranch = isStable ? 'stable' : 'master'; |
| 42 | let shouldUpdateMasterFromStable = tag.endsWith('-beta.1'); |
| 43 | let branchToClone = shouldUpdateMasterFromStable ? 'stable' : outputRepoBranch; |
| 44 | let tmpdir = tmp.dirSync(); |
| 45 | |
| 46 | let outputRepoPath = await cloneBranch(tmpdir.name, { |
| 47 | repo: `https://github-actions:${GITHUB_TOKEN}@github.com/${repoName}.git`, |
| 48 | branch: branchToClone, |
| 49 | }); |
| 50 | |
| 51 | await clearRepo(outputRepoPath); |
| 52 | |
| 53 | let generatedOutputPath = await generateOutputFiles({ version, name, command, variant: 'javascript' }); |
| 54 | |
| 55 | console.log('copying generated contents to output repo'); |
| 56 | await fs.copy(generatedOutputPath, outputRepoPath); |
| 57 | |
| 58 | if (shouldUpdateMasterFromStable) { |
| 59 | await execa('git', ['checkout', '-B', 'master'], { cwd: outputRepoPath }); |
| 60 | } |
| 61 | |
| 62 | console.log('commiting updates'); |
| 63 | await execa('git', ['add', '--all'], { cwd: outputRepoPath }); |
| 64 | await execa('git', ['commit', '-m', tag], { cwd: outputRepoPath }); |
| 65 | await execa('git', ['tag', `-f`, `v${version}`], { cwd: outputRepoPath }); |
| 66 | |
| 67 | console.log('pushing commit & tag'); |
| 68 | await execa('git', ['push', 'origin', `v${version}`, '--force'], { cwd: outputRepoPath }); |
| 69 | |
| 70 | // Only push this branch if we are using an up-to-date tag |
| 71 | if ((isStable && isLatest) || (!isStable && isLatestBeta)) { |
| 72 | await execa('git', ['push', '--force', 'origin', outputRepoBranch], { cwd: outputRepoPath }); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | updateRepo(tag); |
no test coverage detected
searching dependent graphs…