提交 8ea69472 编写于 作者: 李少辉-开发者's avatar 李少辉-开发者 🎧

add ci config

Signed-off-by: 李少辉-开发者's avatarlish <lish@csdn.net>
上级 58887002
default: default:
image: node:latest image: node:latest
# Validate that the repository contains a package.json and extract a few values from it.
before_script: before_script:
- | - |
if [[ ! -f package.json ]]; then if [[ ! -f package.json ]]; then
...@@ -10,24 +8,39 @@ default: ...@@ -10,24 +8,39 @@ default:
fi fi
- echo "current version is :" - echo "current version is :"
- echo $(node -p "require('./package.json').version") - echo $(node -p "require('./package.json').version")
stages: stages:
- build
- test - test
- deploy
install: check:
stage: build stage: test
script: script:
- npm install - npm install
- npm run build - npm run build
check: publish:
stage: test stage: deploy
script: script:
# If no .npmrc if included in the repo, generate a temporary one
- |
if [[ ! -f .npmrc ]]; then
echo 'No .npmrc found! Creating one now. Now we will generate one'
{
echo "//registry.npmjs.org/:_authToken=\${NPM_PUBLISH_TOKEN}"
} >> .npmrc
fi
- echo "Created the following .npmrc:"; cat .npmrc
# Extract a few values from package.json
- NPM_PACKAGE_NAME=$(node -p "require('./package.json').name")
- NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
# Compare the version in package.json to all published versions.
# If the package.json version has not yet been published, run `npm publish`.
- | - |
if [[ ! -f dist/markdown-editor.js ]]; then if [[ $(npm view "${NPM_PACKAGE_NAME}" versions) != *"'${NPM_PACKAGE_VERSION}'"* ]]; then
echo "failed!" npm publish
echo "Successfully published version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} "
else
echo "Version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} has already been published, so no new version has been published."
fi fi
-
exit 1
{ {
"name": "markdown-editor", "name": "cc-md-editor",
"description": " A open source markdown editor of csdn codechina team contributed", "version": "0.1.0",
"version": "0.1.1", "description": "A open source markdown editor of csdn codechina",
"publisher": "guoweijia", "main": "main.js",
"scripts": { "scripts": {
"start": "webpack serve --mode=development", "start": "webpack serve --mode=development",
"build": "webpack --mode=production" "build": "webpack --mode=production"
}, },
"repository": {
"type": "git",
"url": "https://codechina.csdn.net/codechina_dev/markdown-editor.git"
},
"keywords": [
"markdown",
"editor"
],
"author": "guoweijia",
"license": "MIT",
"devDependencies": { "devDependencies": {
"chalk": "^4.1.1", "chalk": "^4.1.1",
"css-loader": "^5.2.6", "css-loader": "^5.2.6",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册