From 7fad6d7e117dbb803753ad63d31572331b8e5ab4 Mon Sep 17 00:00:00 2001 From: Orkun Date: Fri, 20 Oct 2023 12:46:38 +0300 Subject: [PATCH 1/5] feat(semantic-release): add semantic-release --- .github/CODEOWNERS | 4 + .github/workflows/release.yml | 39 ++++++++++ .releaserc.json | 136 ++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..64c5999 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. +# See https://help.github.com/articles/about-code-owners/ + +* @Orkuncakilkaya @necipallef \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9d5a002 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + workflow_dispatch: + + +jobs: + release: + name: Release new version + environment: production + runs-on: ubuntu-latest + + if: github.ref_protected == true + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version-file: '.node-version' + + - name: Install Node packages + run: yarn install + - name: Build + run: yarn build --type all + - name: Semantic Release + uses: cycjimmy/semantic-release-action@91ab76a4a393a8d0c4739e9aea1818b56bc953ea + with: + extra_plugins: | + @semantic-release/exec@6.0.3 + conventional-changelog-conventionalcommits@5.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} + HUSKY: 0 diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..17f983b --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,136 @@ +{ + "branches":[ + "main" + ], + "plugins":[ + [ + "@semantic-release/commit-analyzer", + { + "releaseRules":[ + { + "type":"build", + "scope":"deps", + "release":"patch" + }, + { + "type":"docs", + "scope":"README", + "release":"patch" + } + ] + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset":"conventionalCommits", + "presetConfig":{ + "types":[ + { + "type":"feat", + "section":"Features" + }, + { + "type":"feature", + "section":"Features" + }, + { + "type":"fix", + "section":"Bug Fixes" + }, + { + "type":"perf", + "section":"Performance Improvements" + }, + { + "type":"revert", + "section":"Reverts" + }, + { + "type":"docs", + "scope":"README", + "section":"Documentation" + }, + { + "type":"build", + "scope":"deps", + "section":"Build System" + }, + { + "type":"docs", + "section":"Documentation", + "hidden":true + }, + { + "type":"style", + "section":"Styles", + "hidden":true + }, + { + "type":"chore", + "section":"Miscellaneous Chores", + "hidden":true + }, + { + "type":"refactor", + "section":"Code Refactoring", + "hidden":true + }, + { + "type":"test", + "section":"Tests", + "hidden":true + }, + { + "type":"build", + "section":"Build System", + "hidden":true + }, + { + "type":"ci", + "section":"Continuous Integration", + "hidden":true + } + ] + } + } + ], + "@semantic-release/changelog", + [ + "@semantic-release/npm", + { + "npmPublish":false + } + ], + [ + "@semantic-release/exec", + { + "prepareCmd":"yarn build --type all" + } + ], + [ + "@semantic-release/git", + { + "assets":[ + "CHANGELOG.md", + "package.json" + ] + } + ], + [ + "@semantic-release/github", + { + "assets":[ + { + "path":"dist/terraform/json/fingerprint.json", + "label":"fingerprint-property-rules-for-terraform.json" + }, + { + "path":"dist/terraform/json/variables.json", + "label":"fingerprint-property-variables-for-terraform.json" + } + ] + } + ] + ] +} \ No newline at end of file From 483885bf31b48477d338fcf580512b61b33e2706 Mon Sep 17 00:00:00 2001 From: Orkun Date: Fri, 20 Oct 2023 14:06:12 +0300 Subject: [PATCH 2/5] chore: use our reusable release workflow --- .github/workflows/release.yml | 47 ++++++++--------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d5a002..6b53066 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,39 +1,12 @@ -name: Release - +name: release on: - workflow_dispatch: - - + push: + branches: + - main jobs: - release: - name: Release new version - environment: production - runs-on: ubuntu-latest - - if: github.ref_protected == true - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - - - name: Install node - uses: actions/setup-node@v3 - with: - node-version-file: '.node-version' - - - name: Install Node packages - run: yarn install - - name: Build - run: yarn build --type all - - name: Semantic Release - uses: cycjimmy/semantic-release-action@91ab76a4a393a8d0c4739e9aea1818b56bc953ea - with: - extra_plugins: | - @semantic-release/exec@6.0.3 - conventional-changelog-conventionalcommits@5.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} - HUSKY: 0 + release-workflow: + uses: fingerprintjs/dx-team-toolkit/.github/workflows/release-typescript-project.yml@v1 + with: + distFolderNeedForRelease: true + secrets: + GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} \ No newline at end of file From 74da9ca614f80e17822dc1e74b66368bad492ff3 Mon Sep 17 00:00:00 2001 From: Orkun Date: Fri, 20 Oct 2023 14:14:03 +0300 Subject: [PATCH 3/5] chore: add dummy test command so release can work --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 11335ff..ae4839c 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ } }, "scripts": { + "test": "echo 1", "build": "ts-node build.ts", "test:e2e": "npx playwright test --workers=8 --max-failures=1", "prepare": "husky install" From e057ac513c59d56cb9855e97cfd257c79ca5456d Mon Sep 17 00:00:00 2001 From: Orkun Date: Fri, 20 Oct 2023 14:19:12 +0300 Subject: [PATCH 4/5] chore: add dummy commands to make release work --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ae4839c..a1d876c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ } }, "scripts": { - "test": "echo 1", + "test": "echo \"there are no tests planned\"", + "test:dts": "echo \"there are no typechecks planned\"", + "lint": "echo \"linter is not implemented yet\"", "build": "ts-node build.ts", "test:e2e": "npx playwright test --workers=8 --max-failures=1", "prepare": "husky install" From ab592925261d6515026d0ff9a176167cbccb94d1 Mon Sep 17 00:00:00 2001 From: Orkun Date: Fri, 20 Oct 2023 14:31:24 +0300 Subject: [PATCH 5/5] fix: spaces on release workflow --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b53066..7a21115 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,5 +8,5 @@ jobs: uses: fingerprintjs/dx-team-toolkit/.github/workflows/release-typescript-project.yml@v1 with: distFolderNeedForRelease: true - secrets: - GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} \ No newline at end of file + secrets: + GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} \ No newline at end of file