From 96a8ab301b1ecb3cdd7334f921be0a0ad2020447 Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Thu, 15 Aug 2019 13:16:28 +0200 Subject: [PATCH] Add Travis CI deploy step for release tags (#1558) * Add sample Travis CI deploy step to tag commits on master and push that TODO: should find the version number from ./package.json * Get git name and email for tagging from env * Extract current version number from manifest Attempt... * Update .travis.yml Fix whitespace issue and command error * Switch sed order and escape double qoutes * Replace curly braces by parentheses * Test deploy of release tag to GitHub * Convert deploy back to script And update actual deploy step commands * Remove test deploy stage * Fix api_key value and remove leftover configuration --- .travis.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6f9d1a82..8b09d563 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,19 @@ jobs: - npm run test - stage: deploy - name: "NPM Package" + name: "Git tag" + if: branch = master + + before_deploy: + - git config --local user.name "$GITHUB_USERNAME" + - git config --local user.email "$GITHUB_EMAIL" + - export PACKAGE_VERSION=$(cat package.json | grep 'version' | sed 's/[ \",:]//g' | sed 's/version//') + - git tag $PACKAGE_VERSION + deploy: + provider: releases + api_key: "$GITHUB_TOKEN" + skip_cleanup: true + - name: "NPM Package" language: node_js node_js: 8 if: branch = master