Skip to content

Commit 9d40ed9

Browse files
authored
fix(scripts): push tags on release (#721)
1 parent 9331070 commit 9d40ed9

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

scripts/ci/codegen/spreadGeneration.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable no-console */
2-
import execa from 'execa';
32
import { copy } from 'fs-extra';
43

54
import {
@@ -109,8 +108,8 @@ async function spreadGeneration(): Promise<void> {
109108
await run(`git push --delete origin ${RELEASED_TAG}`);
110109

111110
console.log('Creating new `released` tag for latest commit');
112-
await run(`git tag released`);
113-
await run(`git push --tags`);
111+
await run('git tag released');
112+
await run('git push --tags');
114113
}
115114

116115
for (const lang of langs) {
@@ -149,18 +148,25 @@ async function spreadGeneration(): Promise<void> {
149148
const commitMessage = cleanUpCommitMessage(lastCommitMessage, version);
150149

151150
await configureGitHubAuthor(tempGitDir);
151+
152152
await run('git add .', { cwd: tempGitDir });
153153
await gitCommit({
154154
message: commitMessage,
155155
coAuthors: [author, ...coAuthors],
156156
cwd: tempGitDir,
157157
});
158-
await execa('git', ['tag', version], {
159-
cwd: tempGitDir,
160-
});
161-
await run(IS_RELEASE_COMMIT ? 'git push --follow-tags' : 'git push', {
162-
cwd: tempGitDir,
163-
});
158+
await run('git push', { cwd: tempGitDir });
159+
160+
// In case of a release commit, we also want to update tags on the clients repositories
161+
if (IS_RELEASE_COMMIT) {
162+
console.log(
163+
`Processing release commit, creating new release tag ('${version}') for '${lang}' repository.`
164+
);
165+
166+
await run(`git tag ${version} HEAD`, { cwd: tempGitDir });
167+
await run('git push --tags', { cwd: tempGitDir });
168+
}
169+
164170
console.log(
165171
`✅ Code generation successfully pushed to ${lang} repository.`
166172
);

0 commit comments

Comments
 (0)