123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- kind: pipeline
- name: default
-
- steps:
-
- - name: versioning
- image: node:12
- commands:
- - export PACKAGE_VERSION=$(cat ./package.json | grep version | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
- - export LATEST_VERSION=$(npm view rpclibrary | grep latest | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
- - echo "${PACKAGE_VERSION}"
- - echo "${LATEST_VERSION}"
- - echo "${DRONE_BUILD_CREATED}"
- - git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
- - git config --global user.name "${DRONE_COMMIT_AUTHOR}"
- - >
- if [ "${PACKAGE_VERSION}" != "${LATEST_VERSION}" ];
- then;
- git tag $PACKAGE_VERSION;
- git status;
- git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git $PACKAGE_VERSION;
- else;
- echo 'Version ';
- echo $LATEST_VERSION;
- echo 'did not change. Don`t push tag to master';
- fi
-
- environment:
- GIT_USER:
- from_secret: git_user
- GIT_PASSWORD:
- from_secret: git_password
- trigger:
- event:
- exclude:
- - tag
-
- - name: restore cache
- image: drillster/drone-volume-cache
- settings:
- restore: true
- mount:
- - ./node_modules
- volumes:
- - name: cache
- path: /cache
-
- - name: npm install
- image: node:12
- commands:
- - npm install
-
- - name: npm run build
- image: node:12
- commands:
- - npm run build
-
- - name: rebuild cache
- image: drillster/drone-volume-cache
- settings:
- rebuild: true
- mount:
- - ./node_modules
- volumes:
- - name: cache
- path: /cache
-
- - name: npm run test
- image: node:12
- commands:
- - npm run test
-
- - name: rebuild documentation
- image: node:12
- commands:
- - rm -rf docs
- - npm run docs
- trigger:
- event:
- - tag
-
- - name: npm publish
- image: plugins/npm
- settings:
- username: frontwork
- password:
- from_secret: npm_password
- email: frontwork.me@gmail.com
- trigger:
- event:
- - tag
-
- - name: commit documentation
- image: node:12
- commands:
- - git config --global user.email "frontwork.me@gmail.com"
- - git config --global user.name "drone"
- - git add -f docs
- - git commit --allow-empty -m "documented version at ${DRONE_BUILD_CREATED}"
- - git tag ${DRONE_BUILD_CREATED}
- - git status
- - git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git master ${DRONE_BUILD_CREATED}
- environment:
- GIT_USER:
- from_secret: git_user
- GIT_PASSWORD:
- from_secret: git_password
- trigger:
- event:
- - tag
-
- volumes:
- - name: cache
- host:
- path: /tmp
|