chore: git tag after npm publish (#48454)

This commit is contained in:
afc163 2024-04-15 15:53:50 +08:00 committed by GitHub
parent b42ffe64f4
commit 9517942fac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 8 deletions

View File

@ -182,7 +182,7 @@
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@madccc/duplicate-package-checker-webpack-plugin": "^1.0.0",
"@microflash/rehype-figure": "^2.1.0",
"@npmcli/run-script": "^7.0.4",
"@npmcli/run-script": "^8.0.0",
"@octokit/rest": "^20.1.0",
"@qixian.cs/github-contributors-list": "^2.0.1",
"@size-limit/file": "^11.1.2",

View File

@ -1,13 +1,15 @@
/* eslint-disable no-console */
import { spawnSync } from 'child_process';
import { spawnSync, execSync } from 'child_process';
import chalk from 'chalk';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import inquirer from 'inquirer';
import fetch from 'isomorphic-fetch';
import semver from 'semver';
import ora from 'ora';
import deprecatedVersions from '../BUG_VERSIONS.json';
import { version as packageVersion } from '../package.json';
dayjs.extend(relativeTime);
@ -30,12 +32,18 @@ const SAFE_DAYS_START = 1000 * 60 * 60 * 24 * 15; // 15 days
const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be stable
(async function process() {
console.log(chalk.cyan('🤖 Post Publish Scripting...\n'));
console.log('🤖 Post Publish Scripting...\n');
// if (packageJson.version.startsWith('5.0')) {
// console.log(chalk.green('🤖 Next version, skipped.'));
// return;
// }
// git tag
const spinner = ora(chalk.cyan(`Tagging ${packageVersion}`)).start();
execSync(`git tag ${packageVersion}`);
execSync(`git push origin ${packageVersion}:${packageVersion}`);
spinner.succeed(
chalk.cyan(
`Tagged ${packageVersion} 📦: https://github.com/ant-design/ant-design/releases/tag/${packageVersion}`,
),
);
console.log();
const { time, 'dist-tags': distTags } = await fetch('http://registry.npmjs.org/antd').then(
(res: Response) => res.json(),

View File

@ -63,7 +63,7 @@ async function downloadArtifact(url: string, filepath: string) {
const runPrePublish = async () => {
await checkRepo();
const spinner = ora('Loading unicorns').start();
const spinner = ora();
spinner.info(chalk.black.bgGreenBright('本次发布将跳过本地 CI 检查,远程 CI 通过后方可发布'));
const git = simpleGit();
const octokit = new Octokit({ auth: process.env.GITHUB_ACCESS_TOKEN });