Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: git tag after npm publish #48454

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 15 additions & 7 deletions scripts/post-publish.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -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'));

// if (packageJson.version.startsWith('5.0')) {
// console.log(chalk.green('🤖 Next version, skipped.'));
// return;
// }
console.log('🤖 Post Publish Scripting...\n');

// 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(),
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down