From 97a81d9e21f5fbd5a23f3a92d8397c7d47d079b7 Mon Sep 17 00:00:00 2001 From: Gabi Dobocan Date: Fri, 2 Sep 2022 15:36:09 +0300 Subject: [PATCH] feat: automate releases --- .circleci/config.yml | 72 ++++++++++++++++++++++++++++++++++++-- release-please-config.json | 2 +- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ed5e504..795e022 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,16 +83,47 @@ jobs: steps: - attach_workspace: at: . - - node/install: - install-yarn: true - run: name: Run tests command: yarn test-node-unit - store_test_results: path: ./ + release-pr: + executor: node/default + steps: + - attach_workspace: + at: . + - run: + name: Install release-please + command: npm i release-please -g + - run: + name: Create or update release PR + command: release-please release-pr --token=${GH_TOKEN} --repo-url=sandworm-hq/sandworm-js + github-release: + executor: node/default + steps: + - attach_workspace: + at: . + - run: + name: Install release-please + command: npm i release-please -g + - run: + name: Create release + command: release-please github-release --token=${GH_TOKEN} --repo-url=sandworm-hq/sandworm-js + publish-npm: + executor: node/default + steps: + - attach_workspace: + at: . + - run: + name: Auth With NPM + command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + - run: + name: Publish to NPM + command: npm publish workflows: - test: + test-n-publish: jobs: - setup - lint: @@ -104,12 +135,21 @@ workflows: - test-unit: requires: - build + filters: + tags: + ignore: /^v.*/ - test-web: requires: - build + filters: + tags: + ignore: /^v.*/ - test-node: requires: - build + filters: + tags: + ignore: /^v.*/ matrix: parameters: version: @@ -132,3 +172,29 @@ workflows: - "17.9" # - "18.0" # - "18.4" + - github-release: + requires: + - test-unit + - test-web + - test-node + filters: + branches: + only: main + tags: + ignore: /^v.*/ + - release-pr: + requires: + - github-release + filters: + branches: + only: main + tags: + ignore: /^v.*/ + - publish-npm: + requires: + - build + filters: + branches: + only: main + tags: + only: /^v.*/ diff --git a/release-please-config.json b/release-please-config.json index daa564f..d6e478b 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,7 +5,7 @@ "release-type": "node", "bump-minor-pre-major": false, "bump-patch-for-minor-pre-major": false, - "draft": false, + "draft": true, "prerelease": false } }