-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
白云苍狗
committed
Oct 30, 2023
1 parent
7faf3a5
commit 5da5618
Showing
5 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: NPM Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- "cli-v*" | ||
jobs: | ||
build: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://registry.npmjs.org" | ||
cache: yarn | ||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: | | ||
node ./scripts/publish.mjs | ||
cd ./packages/async-cli | ||
npm run build | ||
npm publish | ||
env: | ||
RELEASE_VERSION: ${{ github.ref }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import { writeFileSync } from "fs"; | ||
import { resolve } from "path"; | ||
import { fileURLToPath } from "url"; | ||
import pkg from "../packages/vitepress-theme-async/package.json" assert { type: "json" }; | ||
import themepkg from "../packages/vitepress-theme-async/package.json" assert { type: "json" }; | ||
import clipkg from "../packages/async-cli/package.json" assert { type: "json" }; | ||
|
||
|
||
if (process.env.RELEASE_VERSION) { | ||
const version = process.env.RELEASE_VERSION.split("/").reverse()[0]; | ||
console.log("当前版本:", version); | ||
pkg.version = version.replace("v", ""); | ||
writeFileSync(resolve(fileURLToPath(import.meta.url), "../../packages/vitepress-theme-async/package.json"), JSON.stringify(pkg, null, 4), "utf-8"); | ||
themepkg.version = version.replace("v", ""); | ||
clipkg.version = version.replace("cli-v", ""); | ||
writeFileSync(resolve(fileURLToPath(import.meta.url), "../../packages/vitepress-theme-async/package.json"), JSON.stringify(themepkg, null, 4), "utf-8"); | ||
writeFileSync(resolve(fileURLToPath(import.meta.url), "../../packages/async-cli/package.json"), JSON.stringify(clipkg, null, 4), "utf-8"); | ||
} |