|
1 | 1 | /* eslint-disable no-console */
|
2 |
| -import execa from 'execa'; |
3 | 2 | import { copy } from 'fs-extra';
|
4 | 3 |
|
5 | 4 | import {
|
@@ -109,8 +108,8 @@ async function spreadGeneration(): Promise<void> {
|
109 | 108 | await run(`git push --delete origin ${RELEASED_TAG}`);
|
110 | 109 |
|
111 | 110 | 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'); |
114 | 113 | }
|
115 | 114 |
|
116 | 115 | for (const lang of langs) {
|
@@ -149,18 +148,25 @@ async function spreadGeneration(): Promise<void> {
|
149 | 148 | const commitMessage = cleanUpCommitMessage(lastCommitMessage, version);
|
150 | 149 |
|
151 | 150 | await configureGitHubAuthor(tempGitDir);
|
| 151 | + |
152 | 152 | await run('git add .', { cwd: tempGitDir });
|
153 | 153 | await gitCommit({
|
154 | 154 | message: commitMessage,
|
155 | 155 | coAuthors: [author, ...coAuthors],
|
156 | 156 | cwd: tempGitDir,
|
157 | 157 | });
|
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 | + |
164 | 170 | console.log(
|
165 | 171 | `✅ Code generation successfully pushed to ${lang} repository.`
|
166 | 172 | );
|
|
0 commit comments