From 3d4436be8cd34fcaf6aadb244164fe7898cfd762 Mon Sep 17 00:00:00 2001 From: Scott Prue Date: Tue, 16 Jun 2020 15:22:07 -0700 Subject: [PATCH] Add Github Actions CI (#2) --- .github/workflows/publish.yml | 76 +++++++++++++++++++++++++++++++++++ .travis.yml | 31 -------------- 2 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..129c21ddf --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,76 @@ +name: NPM Package Publish + +on: + push: + branches: + - master + - next + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node 12 + uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Install Dependencies + env: + HUSKY_SKIP_INSTALL: 1 # Skip install of Husky + run: yarn install --frozen-lockfile + + # - name: Check Lint + # run: yarn lint + + # - name: Run Tests + # run: | + # yarn test + + - name: Check version changes + uses: EndBug/version-check@v1 + id: check + + - name: Version update detected + if: steps.check.outputs.changed == 'true' + run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' + + - name: Publish + if: steps.check.outputs.changed == 'true' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + GITHUB_REF: ${{ github.ref }} + run: | + npm publish $([ "$GITHUB_REF" == 'refs/heads/next' ] && echo '--tag next') + echo "::set-env name=PACKAGE_VERSION::$(cat package.json | jq -r '.version')" + + # - name: Upload Code Coverage (Codecov) + # if: steps.check.outputs.changed == 'true' && success() + # env: + # CODE_COV: ${{ secrets.CODE_COV }} + # run: bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info + + - name: Create Release + if: github.ref == 'refs/heads/master' && steps.check.outputs.changed == 'true' + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: v${{ env.PACKAGE_VERSION }} + release_name: v${{ env.PACKAGE_VERSION }} + draft: false + prerelease: false \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5449bbffe..000000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -sudo: false - -branches: - only: - - master - - APIv2-master - -language: node_js - -notifications: - email: - recipients: - - devcenter@docusign.com - on_success: never - on_failure: change - -node_js: - - "4" - - "5" - - "6" - - "7" - - "8" - - "9" - - "10" - - "11" - -cache: - directories: - - "node_modules" - -after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"