diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 54391f6..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,76 +0,0 @@ -version: 2.1 - -defaults: &defaults - working_directory: ~/repo - docker: - - image: cimg/node:14.19 - -_steps: - restore_npm_cache: &restore_npm_cache - restore_cache: - keys: - - npm-v1-{{ .Branch }}-{{ checksum "package-lock.json" }} - - npm-v1-{{ .Branch }}- - - npm-v1- - save_npm_cache: &save_npm_cache - save_cache: - paths: - - .npm-cache - key: npm-v1-{{ .Branch }}-{{ checksum "package-lock.json" }} - configure_registry_auth: &configure_registry_auth - run: - name: Configure registry auth - command: echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/repo/.npmrc - -jobs: - test: - <<: *defaults - steps: - - checkout - - *restore_npm_cache - - *configure_registry_auth - - run: npm ci --cache .npm-cache - - run: - name: Run coverage tests - command: npm run test:coverage - - run: - name: Run build - command: npm run build - - persist_to_workspace: - root: ~/repo - paths: . - - store_artifacts: - path: ~/repo/dist - - *save_npm_cache - deploy: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - *configure_registry_auth - - run: - name: Publish package - # For now we only publish on tags here and assume the version number is already correct. - # If we change this then we need to automate updating the version number. - command: npm publish $(if [ -z "$CIRCLE_TAG" ]; then echo "--tag next"; fi) - -workflows: - version: 2 - test-deploy: - jobs: - - test: - context: - - "NPM Read" - filters: - tags: - only: /^v.*/ - - deploy: - context: - - "NPM Write" - requires: - - test - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af879ce..f331876 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,19 +1,26 @@ -name: Test & Build - +name: build on: + release: + types: [created] push: - branches: '*' - pull_request: - branches: '*' - + branches: + - '**' jobs: - test-build: - name: Run tests and build project + build: runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + cache: npm - run: npm ci + - run: npm run test:coverage - run: npm run build + - run: npm publish + if: github.event_name == 'release' && github.event.action == 'created' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}