diff --git a/.drone.yml b/.drone.yml index 10b1cab..e52a4f1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,38 @@ kind: pipeline name: default +- name: versioning + image: node:12 + commands: + - git config --global user.email "frontwork.me@gmail.com" + - git config --global user.name "drone" + - > + 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 + - echo "${PACKAGE_VERSION}" + - echo "${LATEST_VERSION}" + environment: + LATEST_VERSION: + $(npm view rpclibrary | grep latest | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') + PACKAGE_VERSION: + $(cat package.json | grep version | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') + GIT_USER: + from_secret: git_user + GIT_PASSWORD: + from_secret: git_password + trigger: + event: + exclude: + - tag + steps: - name: restore cache image: drillster/drone-volume-cache @@ -62,38 +94,6 @@ steps: event: - tag -- name: versioning - image: node:12 - commands: - - git config --global user.email "frontwork.me@gmail.com" - - git config --global user.name "drone" - - > - 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 - - echo "${PACKAGE_VERSION}" - - echo "${LATEST_VERSION}" - environment: - LATEST_VERSION: - $(npm view rpclibrary | grep latest | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') - PACKAGE_VERSION: - $(cat package.json | grep version | head -1 | awk -F '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') - GIT_USER: - from_secret: git_user - GIT_PASSWORD: - from_secret: git_password - trigger: - event: - exclude: - - tag - - name: commit documentation image: node:12 commands: