forked from arve0/markdown-it-attrs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
chore: publish to npmjs in ci
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 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,19 @@ | ||
name: Publish to npmjs.com | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
env: | ||
NPM_TOKEN: ${{secrets.GITLAB_NPM_TOKEN}} | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
cache: 'npm' | ||
- name: Publish | ||
run: ./publish.sh ${GITHUB_REF#refs/*/} |
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 @@ | ||
//registry.npmjs.org/:_authToken=${NPM_TOKEN} |
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,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
[ -z ${1} ] && echo "Please input version" && exit 0 | ||
version=${1} | ||
originName="markdown-it-attrs" | ||
scopedName="@cnblogs\/markdown-it-attrs" | ||
|
||
sed -i "s/\"name\": \"${originName}\"/\"name\": \"${scopedName}\"/" "package.json" | ||
|
||
npm version --no-git-tag-version ${version} | ||
npm publish --access public | ||
|
||
sed -i "s/\"name\": \"${scopedName}\"/\"name\": \"${originName}\"/" "package.json" |