Commit c4600d66 authored by Paul Colin Hennig's avatar Paul Colin Hennig
Browse files

Update .gitlab-ci.yml

parent 6011f75a
......@@ -2,6 +2,7 @@ image: node:latest
stages:
- makedoc
- mirror
- publish
makedoc:
......@@ -22,9 +23,40 @@ makedoc:
- git config --global user.email "runner@$CI_SERVER_HOST"
- git config --global user.name "runner"
- git remote remove origin
- git remote add origin https://runner:${RUNNER_PASSWORD}@$CI_SERVER_HOST/$CI_PROJECT_PATH
- git remote add origin https://runner:$RUNNER_PASSWORD@$CI_SERVER_HOST/$CI_PROJECT_PATH
- git commit README.md -m "🤖 makedoc [skip ci]" || true
- git push --set-upstream origin HEAD:master || true
mirror:
stage: mirror
script:
- DOC_URL=https://doc.y.gy
#install
- yarn add docdash-orange jsdoc jsdoc-to-markdown --dev
# generate index.js from raw
- cat index.raw.js > index.js
- sed -i "s|DOC_URL|$DOC_URL/$CI_PROJECT_NAME|g" index.js
# generate doc
- echo "**This is a mirror of [$CI_SERVER_HOST/$CI_PROJECT_PATH](https://$CI_SERVER_HOST/$CI_PROJECT_PATH)**" > README.md
- cat README_basic.md >> README.md
#github
- node_modules/.bin/jsdoc2md index.js >> README.md
- git config --global user.email "runner@$CI_SERVER_HOST"
- git config --global user.name "runner"
- git fetch --unshallow origin
- git remote remove origin
- git remote add origin https://firstdorsal:$GITHUB_TOKEN@github.com/$CI_PROJECT_PATH.git
- git add -A
- git commit -m "🤖 mirror [skip ci]"
- curl -u "firstdorsal:$GITHUB_TOKEN" https://api.github.com/user/repos -d '{"name":"$CI_PROJECT_NAME"}'
- git push --set-upstream origin HEAD:refs/heads/master -f
#gitlab
- git remote remove origin
- git remote add origin https://firstdorsal:$GITLAB_TOKEN@gitlab.com/$CI_PROJECT_PATH.git
- curl --request POST "https://gitlab.com/api/v4/projects?visibility=public&private_token=$GITLAB_TOKEN&name=$CI_PROJECT_NAME" ; echo
- curl --request DELETE "https://gitlab.com/api/v4/projects/$CI_PROJECT_NAMESPACE%2F$CI_PROJECT_NAME/protected_branches/master?private_token=$GITLAB_TOKEN" ; echo
- git push --set-upstream origin HEAD:refs/heads/master -f
publish:
stage: publish
script:
......@@ -33,5 +65,5 @@ publish:
- cat README_basic.md > README.md
- node_modules/.bin/jsdoc2md index.js >> README.md
#publish to npm
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
- echo '//registry.npmjs.org/:_authToken=$NPM_TOKEN'>.npmrc
- npm publish
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment