From 22a563b7a6462d543848d912553468bd9181f801 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Mon, 12 Jul 2021 17:33:59 +0545 Subject: [PATCH 01/23] Add workflow --- .github/workflows/master.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 25 +++++++++++++++++++++++++ package.json | 4 +++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..01a6a0d --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,35 @@ +# When any change is pushed on master, it triggers a beta +# version release with the @next tag +# +# When a tag is published, it triggers the release flow, +# which takes the version which is released and converts +# it into the @latest tag +name: Process master branch updates + +on: + push: + branches: + - master + +jobs: + push-to-next: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + git config user.name bhoos-devops + git config user.email devops@bhoos.com + echo -e "github.com\n login $GITHUB_TOKEN" >> ~/.netrc + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-node@v1 + with: + node-version: '14.x' + registry-url: 'https://npm.pkg.github.com' + scope: '@bhoos' + - name: Install Dependencies and publish packages + run: | + yarn + yarn patch + env: + NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7cef85 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +# Promote staging version to production (latest) +name: Promote to Production + +on: + release: + type: [published] + +jobs: + production-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14.x' + registry-url: 'https://npm.pkg.github.com' + scope: '@bhoos' + + - name: Publish release + run: | + pkg=$(node -p "require('./package.json').name") + version=$(node -p "require('./package.json').version") + echo "Releasing ${pkg}@${version} to latest" + # The following command doesn't work with `yarn tag` (2021-Jan-06) + npm dist-tag add ${pkg}@${version} latest \ No newline at end of file diff --git a/package.json b/package.json index 2323f28..89de86c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "build:cjs": "tsc", "build:es6": "mkdir -p es6 && echo '{\"type\":\"module\"}' > es6/package.json && tsc --module es6 --outDir es6", "build": "yarn build:cjs && yarn build:es6", - "prepublishOnly": "yarn clean && yarn build" + "prepublishOnly": "yarn clean && yarn build", + "postversion": "git push && git push --tags", + "patch": "npm version patch --yes && npm publish --tag next" }, "files": [ "dist", From 716acd8d889b160d7d993b6098cbbceb40beb2e9 Mon Sep 17 00:00:00 2001 From: bhoos-devops Date: Mon, 12 Jul 2021 11:49:57 +0000 Subject: [PATCH 02/23] 1.0.1 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 89de86c..1f94278 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.0", + "version": "1.0.1", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", @@ -37,4 +37,4 @@ "react": "*", "react-native": "*" } -} \ No newline at end of file +} From 0fb274c131a467c3dc8d8c40166aee8e4b851570 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Mon, 12 Jul 2021 17:48:47 +0545 Subject: [PATCH 03/23] downgrade version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f94278..fbe3e6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.1", + "version": "1.0.0", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 388e5801a2f4fc0f5c1cf7eb167f445a79d057a8 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 13 Jul 2021 10:57:25 +0545 Subject: [PATCH 04/23] 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fbe3e6e..1f94278 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.0", + "version": "1.0.1", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 46bdbebaa313adf671d4c8f0a8edae3c90feabf4 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 13 Jul 2021 10:58:07 +0545 Subject: [PATCH 05/23] 1.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f94278..7e3e482 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.1", + "version": "1.0.2", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From c45f9ae396f1d64dd15dab52d2b00d43e4868bc7 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 13 Jul 2021 11:01:28 +0545 Subject: [PATCH 06/23] match version to origin master --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e3e482..fbe3e6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.2", + "version": "1.0.0", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 3e87600a8a19a88bde8646f00eda55fb69a0566d Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Wed, 14 Jul 2021 16:36:41 +0545 Subject: [PATCH 07/23] Use personal token for publishing to latest tag --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7cef85..dda68e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,4 +22,6 @@ jobs: version=$(node -p "require('./package.json').version") echo "Releasing ${pkg}@${version} to latest" # The following command doesn't work with `yarn tag` (2021-Jan-06) - npm dist-tag add ${pkg}@${version} latest \ No newline at end of file + npm dist-tag add ${pkg}@${version} latest + env: + NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} \ No newline at end of file From 26f0a1282755ee0e9da7ab1fa894422b69210c25 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Thu, 15 Jul 2021 11:52:32 +0545 Subject: [PATCH 08/23] Add release draft --- .github/workflows/master.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 01a6a0d..9694b9f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -31,5 +31,22 @@ jobs: run: | yarn yarn patch + version=$(node -p "require('./package.json').version") + echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV env: - NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release for moving to production + uses: actions/create-release@v1 + with: + tag_name: ${{ env.RELEASE_VERSION }} + release_name: Release v${{ env.RELEASE_VERSION }} + body: ${{steps.github_release.outputs.changelog}} + draft: true + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 09d0a91e2b83a3558156849b21696571acad3609 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 20 Jul 2021 14:38:35 +0545 Subject: [PATCH 09/23] Set the repository --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 1f94278..2fba983 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "es6", "docs" ], + "repository": "git@github.com:bhoos/react-native-kit", "publishConfig": { "registry": "https://npm.pkg.github.com" }, From 4b88098728099444315404e7287bcc8738d53b23 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 20 Jul 2021 15:35:40 +0545 Subject: [PATCH 10/23] Use of github token and fix typo --- .github/workflows/master.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 9694b9f..6ecfe77 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -19,7 +19,7 @@ jobs: - run: | git config user.name bhoos-devops git config user.email devops@bhoos.com - echo -e "github.com\n login $GITHUB_TOKEN" >> ~/.netrc + echo -e "github.com\n login $GITHUB_TOKEN" >> ~/.npmrc env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-node@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dda68e3..5024885 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,4 +24,4 @@ jobs: # The following command doesn't work with `yarn tag` (2021-Jan-06) npm dist-tag add ${pkg}@${version} latest env: - NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 32bb2f2756746448924aecbc17faa9bc5b299d44 Mon Sep 17 00:00:00 2001 From: Niranjan Shakya <11026689+niranjanshk27@users.noreply.github.com> Date: Tue, 20 Jul 2021 15:52:15 +0545 Subject: [PATCH 11/23] Remove netrc file --- .github/workflows/master.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 6ecfe77..75e6b86 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -19,7 +19,6 @@ jobs: - run: | git config user.name bhoos-devops git config user.email devops@bhoos.com - echo -e "github.com\n login $GITHUB_TOKEN" >> ~/.npmrc env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-node@v1 @@ -49,4 +48,4 @@ jobs: draft: true prerelease: false env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 20e44770db908e104d6698bfb576bf08ee779e28 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 24 Aug 2021 19:10:38 +0545 Subject: [PATCH 12/23] release note config --- workflow_config/config.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 workflow_config/config.json diff --git a/workflow_config/config.json b/workflow_config/config.json new file mode 100644 index 0000000..22b4541 --- /dev/null +++ b/workflow_config/config.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "## ๐Ÿš€ Features", + "labels": ["feature"] + }, + { + "title": "## ๐Ÿ› Fixes", + "labels": ["fix"] + }, + { + "title": "## ๐Ÿงช Tests", + "labels": ["test"] + } + ], + "sort": "ASC", + "template": "${{CHANGELOG}}\n\n
\nUncategorized\n\n${{UNCATEGORIZED}}\n
", + "pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", + "empty_template": "- no changes", + "transformers": [ + { + "pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)", + "target": "- $4\n - $6" + } + ], + "max_tags_to_fetch": 200, + "max_pull_requests": 200, + "max_back_track_time_days": 90, + "exclude_merge_branches": [ + "Owner/qa" + ] +} \ No newline at end of file From d97dfda9972e78f6d9f868792177eace6b04c54f Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 24 Aug 2021 19:10:59 +0545 Subject: [PATCH 13/23] update workflow and release action --- .github/workflows/master.yml | 14 +++++++++----- package.json | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 75e6b86..333fc63 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -29,21 +29,25 @@ jobs: - name: Install Dependencies and publish packages run: | yarn - yarn patch + yarn version --patch + yarn publish . --tag next version=$(node -p "require('./package.json').version") - echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV + echo "RELEASE_VERSION=v${version}" >> $GITHUB_ENV env: NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - name: Build Changelog id: github_release uses: mikepenz/release-changelog-builder-action@v1 + with: + configuration: "workflow_config/config.json" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Release for moving to production - uses: actions/create-release@v1 + uses: ncipollo/release-action@v1 with: - tag_name: ${{ env.RELEASE_VERSION }} - release_name: Release v${{ env.RELEASE_VERSION }} + tag: ${{ env.RELEASE_VERSION }} + name: Release ${{ env.RELEASE_VERSION }} + commit: master body: ${{steps.github_release.outputs.changelog}} draft: true prerelease: false diff --git a/package.json b/package.json index 5fefe36..8dc8484 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ "build:es6": "mkdir -p es6 && echo '{\"type\":\"module\"}' > es6/package.json && tsc --module es6 --outDir es6", "build": "yarn build:cjs && yarn build:es6", "prepublishOnly": "yarn clean && yarn build", - "postversion": "git push && git push --tags", - "patch": "npm version patch --yes && npm publish --tag next" + "postversion": "git push && git push --tags" }, "files": [ "dist", From 2719c9f6e13f9f4786684c3acc924609670ac3c8 Mon Sep 17 00:00:00 2001 From: bhoos-devops Date: Tue, 24 Aug 2021 13:33:47 +0000 Subject: [PATCH 14/23] v1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8dc8484..5fb2dd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.2", + "version": "1.0.3", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 965dfe33ef9cf0c5681471b6acc8a005134545d7 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Tue, 24 Aug 2021 19:20:34 +0545 Subject: [PATCH 15/23] downgrade version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fb2dd8..8dc8484 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.3", + "version": "1.0.2", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 39d36820653f71eed1c0e17251bd4bd0c070e17c Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Mon, 27 Sep 2021 14:50:57 +0545 Subject: [PATCH 16/23] fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5024885..c3a76e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Promote to Production on: release: - type: [published] + types: [published] jobs: production-release: From f26dbb32cd7b55440c184a447ae5180a1258bcde Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Mon, 27 Sep 2021 15:18:16 +0545 Subject: [PATCH 17/23] fix release log tempalte --- workflow_config/config.json | 70 +++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/workflow_config/config.json b/workflow_config/config.json index 22b4541..e392e16 100644 --- a/workflow_config/config.json +++ b/workflow_config/config.json @@ -1,32 +1,40 @@ { - "categories": [ - { - "title": "## ๐Ÿš€ Features", - "labels": ["feature"] - }, - { - "title": "## ๐Ÿ› Fixes", - "labels": ["fix"] - }, - { - "title": "## ๐Ÿงช Tests", - "labels": ["test"] - } - ], - "sort": "ASC", - "template": "${{CHANGELOG}}\n\n
\nUncategorized\n\n${{UNCATEGORIZED}}\n
", - "pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", - "empty_template": "- no changes", - "transformers": [ - { - "pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)", - "target": "- $4\n - $6" - } - ], - "max_tags_to_fetch": 200, - "max_pull_requests": 200, - "max_back_track_time_days": 90, - "exclude_merge_branches": [ - "Owner/qa" - ] -} \ No newline at end of file + "categories": [ + { + "title": "## ๐Ÿš€ Features", + "labels": ["feature"] + }, + { + "title": "## ๐Ÿ› ๏ธ Fixes", + "labels": ["fix"] + }, + { + "title": "## ๐Ÿ› Bug", + "labels": ["bug"] + }, + { + "title": "## ๐Ÿงช Enhancement", + "labels": ["enhancement"] + }, + { + "title": "## ๐Ÿ“˜ Documentation", + "labels": ["documentation"] + } + ], + "sort": "ASC", + "template": "${{CHANGELOG}}\n\n
\n๐Ÿ’ฌ Uncategorized\n\n${{UNCATEGORIZED}}\n
", + "pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", + "empty_template": "- no changes", + "transformers": [ + { + "pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)", + "target": "- $4\n - $6" + } + ], + "max_tags_to_fetch": 200, + "max_pull_requests": 200, + "max_back_track_time_days": 90, + "exclude_merge_branches": [ + "Owner/qa" + ] + } \ No newline at end of file From 6b8a4a64548456e648e083fc6682acb8cc8e41a1 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Wed, 19 Jan 2022 21:36:34 +0545 Subject: [PATCH 18/23] delete log config --- workflow_config/config.json | 40 ------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 workflow_config/config.json diff --git a/workflow_config/config.json b/workflow_config/config.json deleted file mode 100644 index e392e16..0000000 --- a/workflow_config/config.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "categories": [ - { - "title": "## ๐Ÿš€ Features", - "labels": ["feature"] - }, - { - "title": "## ๐Ÿ› ๏ธ Fixes", - "labels": ["fix"] - }, - { - "title": "## ๐Ÿ› Bug", - "labels": ["bug"] - }, - { - "title": "## ๐Ÿงช Enhancement", - "labels": ["enhancement"] - }, - { - "title": "## ๐Ÿ“˜ Documentation", - "labels": ["documentation"] - } - ], - "sort": "ASC", - "template": "${{CHANGELOG}}\n\n
\n๐Ÿ’ฌ Uncategorized\n\n${{UNCATEGORIZED}}\n
", - "pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", - "empty_template": "- no changes", - "transformers": [ - { - "pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)", - "target": "- $4\n - $6" - } - ], - "max_tags_to_fetch": 200, - "max_pull_requests": 200, - "max_back_track_time_days": 90, - "exclude_merge_branches": [ - "Owner/qa" - ] - } \ No newline at end of file From 7cc8a9d77a3e58b2bfbbed4c3bec2337c0f366a2 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Wed, 19 Jan 2022 21:36:48 +0545 Subject: [PATCH 19/23] add pr check --- .github/workflows/checkPR.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/checkPR.yml diff --git a/.github/workflows/checkPR.yml b/.github/workflows/checkPR.yml new file mode 100644 index 0000000..b63ecb9 --- /dev/null +++ b/.github/workflows/checkPR.yml @@ -0,0 +1,41 @@ +# This workflow check current version and the latest tag version +# if current version and latest version is same than PR check fail +# if current version and latest version is not same than PR check pass + +name: PR Check + +on: + pull_request: + branches: + - master + +jobs: + pr-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Get current version and tag + run: | + vercmp() { + version1=$1 version2=$2 condition=$3 + IFS=. v1_array=($version1) v2_array=($version2) + v1=$((v1_array[0] * 100 + v1_array[1] * 10 + v1_array[2])) + v2=$((v2_array[0] * 100 + v2_array[1] * 10 + v2_array[2])) + diff=$((v2 - v1)) + [[ $condition = '=' ]] && ((diff == 0)) && return 0 + [[ $condition = '!=' ]] && ((diff != 0)) && return 0 + [[ $condition = '<' ]] && ((diff > 0)) && return 0 + [[ $condition = '<=' ]] && ((diff >= 0)) && return 0 + [[ $condition = '>' ]] && ((diff < 0)) && return 0 + [[ $condition = '>=' ]] && ((diff <= 0)) && return 0 + return 1 + } + version=$(node -p "require('./package.json').version") + tag="$(git describe --tag --abbrev=0 | cut -c 2-)" + echo "Version: $version" + echo "TAG: $tag" + # vercmp "$version" "$tag" ">" && echo "::set-output name=IS_VALID::true" || echo "::set-output name=IS_VALID::false" + vercmp "$version" "$tag" ">" && exit 0 || exit 1 \ No newline at end of file From 3297267d28c64e987083a701506025beb53f25ca Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Wed, 19 Jan 2022 21:37:01 +0545 Subject: [PATCH 20/23] rename file and update workflow --- .../workflows/{master.yml => onComment.yml} | 31 +++++++------------ .../{release.yml => onPublished.yml} | 17 ++++++++-- 2 files changed, 27 insertions(+), 21 deletions(-) rename .github/workflows/{master.yml => onComment.yml} (63%) rename .github/workflows/{release.yml => onPublished.yml} (52%) diff --git a/.github/workflows/master.yml b/.github/workflows/onComment.yml similarity index 63% rename from .github/workflows/master.yml rename to .github/workflows/onComment.yml index 9c31054..91caba5 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/onComment.yml @@ -1,18 +1,16 @@ -# When any change is pushed on master, it triggers a beta -# version release with the @next tag -# -# When a tag is published, it triggers the release flow, -# which takes the version which is released and converts -# it into the @latest tag -name: Process master branch updates +# When issue is created with title "Deploy" and anybody +# comment "/deploy" in comment this workflow is triggered. +# This workflow publish the package in @next tag. + +name: Process master branch for @next tag on: - push: - branches: - - master + issue_comment: + types: [created] jobs: push-to-next: + if: ${{ github.event.issue.title == 'Deploy' && github.event.comment.body == '/deploy' && github.event.issue.state == 'open' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -26,27 +24,22 @@ jobs: node-version: '14.x' registry-url: 'https://npm.pkg.github.com' scope: '@bhoos' + - name: Install Dependencies and publish packages run: | yarn - yarn version --patch yarn publish . --tag next version=$(node -p "require('./package.json').version") echo "RELEASE_VERSION=v${version}" >> $GITHUB_ENV + echo "ISSUE_NUMBER=${{github.event.issue.number}}" >> $GITHUB_ENV env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v1 - with: - configuration: "workflow_config/config.json" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release for moving to production uses: ncipollo/release-action@v1 with: tag: ${{ env.RELEASE_VERSION }} - name: Release ${{ env.RELEASE_VERSION }} + name: Release ${{ env.RELEASE_VERSION }} (#${{ env.ISSUE_NUMBER }}) commit: master body: ${{steps.github_release.outputs.changelog}} draft: true diff --git a/.github/workflows/release.yml b/.github/workflows/onPublished.yml similarity index 52% rename from .github/workflows/release.yml rename to .github/workflows/onPublished.yml index c3a76e0..a1dc0dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/onPublished.yml @@ -1,5 +1,5 @@ # Promote staging version to production (latest) -name: Promote to Production +name: Promote to Production (@latest tag) on: release: @@ -18,10 +18,23 @@ jobs: - name: Publish release run: | + echo "ISSUE_NUMBER=$(echo $NUMBER | awk -F'[\#\)]' '{print $2}')" >> $GITHUB_ENV pkg=$(node -p "require('./package.json').name") version=$(node -p "require('./package.json').version") echo "Releasing ${pkg}@${version} to latest" # The following command doesn't work with `yarn tag` (2021-Jan-06) npm dist-tag add ${pkg}@${version} latest env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NUMBER: ${{github.event.release.name}} + # Close issue + - name: Close Issue + uses: peter-evans/close-issue@v1 + with: + issue-number: ${{ env.ISSUE_NUMBER }} + comment: This issue is tested and realeased. Auto-closing issue. + # Deletes any release marked as a draft + - name: Delete drafts + uses: hugo19941994/delete-draft-releases@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From cd7575891535961d75bca2f26bf85e6eb2303a32 Mon Sep 17 00:00:00 2001 From: Niranjan Shk Date: Wed, 19 Jan 2022 21:37:36 +0545 Subject: [PATCH 21/23] Bump Version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31e8be5..ac8178d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-native-kit", - "version": "1.0.7", + "version": "1.0.8", "description": "Bhoos React Native Library", "main": "dist/index.js", "module": "es6/index.js", From 4ad42be602189a1bac1740a8edbb09779dce558d Mon Sep 17 00:00:00 2001 From: niranjanshk Date: Fri, 9 Sep 2022 12:21:00 +0545 Subject: [PATCH 22/23] remove scripts --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index ac8178d..af4b019 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,7 @@ "clean": "rimraf dist && rimraf es6", "build:cjs": "tsc", "build:es6": "mkdir -p es6 && echo '{\"type\":\"module\"}' > es6/package.json && tsc --module es6 --outDir es6", - "build": "yarn build:cjs && yarn build:es6", - "prepublishOnly": "yarn clean && yarn build", - "postversion": "git push && git push --tags" + "build": "yarn build:cjs && yarn build:es6" }, "files": [ "dist", From acc1cf5f99ae9087360d99f638636e47a1d649da Mon Sep 17 00:00:00 2001 From: niranjanshk Date: Fri, 9 Sep 2022 12:21:10 +0545 Subject: [PATCH 23/23] update flow --- .github/workflows/checkPR.yml | 29 +++++++++-------------------- .github/workflows/onComment.yml | 4 +++- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/checkPR.yml b/.github/workflows/checkPR.yml index b63ecb9..ae34c91 100644 --- a/.github/workflows/checkPR.yml +++ b/.github/workflows/checkPR.yml @@ -16,26 +16,15 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - + - name: Get current version and tag run: | - vercmp() { - version1=$1 version2=$2 condition=$3 - IFS=. v1_array=($version1) v2_array=($version2) - v1=$((v1_array[0] * 100 + v1_array[1] * 10 + v1_array[2])) - v2=$((v2_array[0] * 100 + v2_array[1] * 10 + v2_array[2])) - diff=$((v2 - v1)) - [[ $condition = '=' ]] && ((diff == 0)) && return 0 - [[ $condition = '!=' ]] && ((diff != 0)) && return 0 - [[ $condition = '<' ]] && ((diff > 0)) && return 0 - [[ $condition = '<=' ]] && ((diff >= 0)) && return 0 - [[ $condition = '>' ]] && ((diff < 0)) && return 0 - [[ $condition = '>=' ]] && ((diff <= 0)) && return 0 - return 1 - } - version=$(node -p "require('./package.json').version") + version="$(node -p "require('./package.json').version")" tag="$(git describe --tag --abbrev=0 | cut -c 2-)" - echo "Version: $version" - echo "TAG: $tag" - # vercmp "$version" "$tag" ">" && echo "::set-output name=IS_VALID::true" || echo "::set-output name=IS_VALID::false" - vercmp "$version" "$tag" ">" && exit 0 || exit 1 \ No newline at end of file + if [ "$version" == "$tag" ]; then + echo "Current version and the recent tag version is same. Please update the version in package.json file." + exit 1; + else + echo "Current verions:$version Tag:$tag \nThis PR is ready to merge." + exit 0; + fi \ No newline at end of file diff --git a/.github/workflows/onComment.yml b/.github/workflows/onComment.yml index 91caba5..30b90d5 100644 --- a/.github/workflows/onComment.yml +++ b/.github/workflows/onComment.yml @@ -28,10 +28,12 @@ jobs: - name: Install Dependencies and publish packages run: | yarn - yarn publish . --tag next version=$(node -p "require('./package.json').version") echo "RELEASE_VERSION=v${version}" >> $GITHUB_ENV echo "ISSUE_NUMBER=${{github.event.issue.number}}" >> $GITHUB_ENV + git push && git push --tags + yarn clean && yarn build + yarn publish . --tag next env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}