regression(ci): Fix publish release automation (#29779)

pull/29814/head
Diego Sampaio 3 years ago
parent 63c91f24a9
commit bed945cfc5
No known key found for this signature in database
GPG Key ID: B71D302EB7F5183C
  1. 2
      .github/workflows/new-release.yml
  2. 2
      .github/workflows/publish-release.yml
  3. 2
      packages/release-action/src/index.ts
  4. 18
      packages/release-action/src/publishRelease.ts

@ -39,7 +39,7 @@ jobs:
- uses: dtinth/setup-github-actions-caching-for-turbo@v1
- name: Build
- name: Build packages
run: yarn build
- name: Start next release

@ -30,7 +30,7 @@ jobs:
- uses: dtinth/setup-github-actions-caching-for-turbo@v1
- name: Build
- name: Build packages
run: yarn build
- name: Publish final release

@ -38,7 +38,7 @@ import { setupGitUser } from './gitUtils';
const mainPackagePath = path.join(cwd, 'apps', 'meteor');
if (action === 'publish-final') {
await publishRelease({ githubToken, exitCandidate: true, mainPackagePath });
await publishRelease({ githubToken, mergeFinal: true, mainPackagePath });
} else if (action === 'publish') {
await publishRelease({ githubToken, baseRef, mainPackagePath });
} else if (action === 'bump') {

@ -14,14 +14,14 @@ import { checkoutBranch, commitChanges, createTag, getCurrentBranch, mergeBranch
export async function publishRelease({
githubToken,
mainPackagePath,
exitCandidate = false,
mergeFinal = false,
baseRef,
cwd = process.cwd(),
}: {
githubToken: string;
mainPackagePath: string;
baseRef?: string;
exitCandidate?: boolean;
mergeFinal?: boolean;
cwd?: string;
}) {
const octokit = setupOctokit(githubToken);
@ -35,7 +35,7 @@ export async function publishRelease({
const { version: currentVersion } = await readPackageJson(cwd);
if (exitCandidate) {
if (mergeFinal) {
let preRelease = false;
try {
fs.accessSync(path.resolve(cwd, '.changeset', 'pre.json'));
@ -76,12 +76,14 @@ export async function publishRelease({
await commitChanges(`Release ${newVersion}`);
// get current branch name
const branchName = await getCurrentBranch();
if (mergeFinal) {
// get current branch name
const branchName = await getCurrentBranch();
// merge release changes to master
await checkoutBranch('master');
await mergeBranch(branchName);
// merge release changes to master
await checkoutBranch('master');
await mergeBranch(branchName);
}
core.info('fix dependencies in workspace packages');
await fixWorkspaceVersionsBeforePublish();

Loading…
Cancel
Save