From d8f9718f18c57f2b6e4b021285b73eca2d24bd75 Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Mon, 19 Sep 2022 07:10:37 +0100 Subject: [PATCH 1/2] Add GitHub Actions wotkflows, remove CircleCI config.yml --- .circleci/config.yml | 69 ------------------- .github/workflows/build-and-test.yml | 7 ++ .../build-test-and-publish-release.yml | 10 +++ 3 files changed, 17 insertions(+), 69 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/build-test-and-publish-release.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b7e0206..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,69 +0,0 @@ -version: 2 - -defaults: &defaults - working_directory: ~/repo - docker: - - image: cimg/node:18.7.0 - -jobs: - test: - <<: *defaults - steps: - - checkout - - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: npm install - - run: - name: Run tests - command: npm test - - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} - - - persist_to_workspace: - root: ~/repo - paths: - - . - deploy: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - run: - name: Authenticate with registry - command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc - - run: - name: Publish package (versioned by git tag) - command: | - npm config set git-tag-version=false - npm version $CIRCLE_TAG - npm publish - -workflows: - version: 2 - test-deploy: - jobs: - - test: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - deploy: - # Add to PublishToNpm context to access the NPM_TOKEN environment variable - context: PublishToNpm - requires: - - test - filters: - tags: - # Only tags beginning x.y.z - only: /^\d+\.\d+\.\d+.*$/ - branches: - ignore: /.*/ diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..ac9a102 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,7 @@ +name: Build and test +on: [push, pull_request] + +jobs: + build-and-test: + name: Build and test + uses: markwhitaker/shared-workflows/.github/workflows/node-build-and-test.yml@main diff --git a/.github/workflows/build-test-and-publish-release.yml b/.github/workflows/build-test-and-publish-release.yml new file mode 100644 index 0000000..4990fae --- /dev/null +++ b/.github/workflows/build-test-and-publish-release.yml @@ -0,0 +1,10 @@ +name: Build, test and publish release +on: + release: + types: [published] + +jobs: + publish-to-nuget: + name: Publish release to npm + uses: markwhitaker/shared-workflows/.github/workflows/node-publish-to-npm.yml@main + secrets: inherit From 660fb6e3d43ccc4acb19a6fa61a518487978753e Mon Sep 17 00:00:00 2001 From: Mark Whitaker Date: Mon, 19 Sep 2022 07:13:17 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1f24ff..4d76c89 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![icon](artwork/MimeTypes-icon-100.png) # MimeTypes.js -[![CircleCI](https://img.shields.io/circleci/build/gh/markwhitaker/MimeTypes.js)](https://circleci.com/gh/markwhitaker/MimeTypes.JS) +[![Build and test](https://github.com/markwhitaker/MimeTypes.js/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/markwhitaker/MimeTypes.js/actions/workflows/build-and-test.yml) [![npm](https://img.shields.io/npm/v/mimetype-constants)](https://www.npmjs.com/package/mimetype-constants) [![npm](https://img.shields.io/npm/dw/mimetype-constants)](https://www.npmjs.com/package/mimetype-constants)