From 44f0a9cf10e04406fe9b8afd1d19c908d438af6b Mon Sep 17 00:00:00 2001 From: Brent Hoover Date: Fri, 19 Aug 2022 12:46:50 +0800 Subject: [PATCH] feat: move publishing to standard circleCI method Signed-off-by: Brent Hoover --- .circleci/config.yml | 65 +++++++++++++++++++++++++++++++++++ .github/workflows/node.js.yml | 47 ------------------------- 2 files changed, 65 insertions(+), 47 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/node.js.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..c2155ec --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,65 @@ +version: 2 +jobs: + build: + docker: + - image: 'node:14' + dependencies: + pre: + - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc' + steps: + - checkout + - run: npm ci + - save_cache: + paths: + - node_modules + key: 'v1-dependencies-{{ checksum "package.json" }}' + deploy: + docker: + - image: 'node:14' + steps: + - checkout + - restore_cache: + keys: + - 'v1-dependencies-{{ checksum "package.json" }}' + - v1-dependencies- + - run: npx semantic-release + lint: + docker: + - image: 'node:14' + steps: + - checkout + - restore_cache: + keys: + - 'v1-dependencies-{{ checksum "package.json" }}' + - v1-dependencies- + - run: npm run lint + test: + docker: + - image: 'node:14' + steps: + - checkout + - restore_cache: + keys: + - 'v1-dependencies-{{ checksum "package.json" }}' + - v1-dependencies- + - run: npm run test +workflows: + version: 2 + build_deploy: + jobs: + - build: + context: reaction-publish-semantic-release + - lint: + requires: + - build + - test: + requires: + - build + - deploy: + context: reaction-publish-semantic-release + requires: + - lint + - test + filters: + branches: + only: trunk diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 3dacde6..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Build, Test and Publish NPM Package - -on: - push: - pull_request: - branches: [$default-branch] - -jobs: - test: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x, 15.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: "npm" - - run: npm ci - - run: npm run lint - - name: Run Test - env: - GH_PUBLISHING_TOKEN: ${{ secrets.GH_PUBLISHING_TOKEN }} - run: npm run test - - release: - needs: test - if: github.ref == 'refs/heads/trunk' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npx semantic-release - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - GITHUB_TOKEN: ${{ secrets.GH_PUBLISHING_TOKEN }}