Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

ci(release-new-version): create GitHub release with release notes (#1669)

Sanchith Hegde8939d78bc8c7
diff --git a/.github/git-cliff-changelog.toml b/.github/git-cliff-changelog.toml
index f403746362..7b9c1780b1 100644
--- a/.github/git-cliff-changelog.toml
+++ b/.github/git-cliff-changelog.toml
@@ -68,7 +68,7 @@ commit_parsers = [
{ message = "^(?i)(refactor)", group = "<!-- 4 -->Refactors" },
{ message = "^(?i)(test)", group = "<!-- 5 -->Testing" },
{ message = "^(?i)(docs)", group = "<!-- 6 -->Documentation" },
- { message = "^(?i)(chore\\(release\\)): prepare for", skip = true },
+ { message = "^(?i)(chore\\(version\\)): V[\\d]+\\.[\\d]+\\.[\\d]+", skip = true },
{ message = "^(?i)(chore)", group = "<!-- 7 -->Miscellaneous Tasks" },
{ message = "^(?i)(build)", group = "<!-- 8 -->Build System / Dependencies" },
{ message = "^(?i)(ci)", skip = true },
diff --git a/.github/git-cliff-release.toml b/.github/git-cliff-release.toml
index be954b7691..027eaea974 100644
--- a/.github/git-cliff-release.toml
+++ b/.github/git-cliff-release.toml
@@ -65,7 +65,7 @@ commit_parsers = [
{ message = "^(?i)(refactor)", group = "<!-- 4 -->Refactors" },
{ message = "^(?i)(test)", group = "<!-- 5 -->Testing" },
{ message = "^(?i)(docs)", group = "<!-- 6 -->Documentation" },
- { message = "^(?i)(chore\\(release\\)): prepare for", skip = true },
+ { message = "^(?i)(chore\\(version\\)): V[\\d]+\\.[\\d]+\\.[\\d]+", skip = true },
{ message = "^(?i)(chore)", group = "<!-- 7 -->Miscellaneous Tasks" },
{ message = "^(?i)(build)", group = "<!-- 8 -->Build System / Dependencies" },
{ message = "^(?i)(ci)", skip = true },
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 6382b4aa09..dfe097fb75 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -93,7 +93,7 @@ jobs:
save-if: ${{ github.event_name == 'push' }}
- name: Install cargo-hack
- uses: baptiste0928/[email protected]
+ uses: baptiste0928/[email protected]
with:
crate: cargo-hack
@@ -258,12 +258,12 @@ jobs:
components: clippy
- name: Install cargo-hack
- uses: baptiste0928/[email protected]
+ uses: baptiste0928/[email protected]
with:
crate: cargo-hack
# - name: Install cargo-nextest
- # uses: baptiste0928/[email protected]
+ # uses: baptiste0928/[email protected]
# with:
# crate: cargo-nextest
diff --git a/.github/workflows/connector-ui-sanity-tests.yml b/.github/workflows/connector-ui-sanity-tests.yml
index e69b438ecd..2a2fddb360 100644
--- a/.github/workflows/connector-ui-sanity-tests.yml
+++ b/.github/workflows/connector-ui-sanity-tests.yml
@@ -105,7 +105,7 @@ jobs:
override: true
- uses: Swatinem/[email protected]
- - uses: baptiste0928/[email protected]
+ - uses: baptiste0928/[email protected]
with:
crate: diesel_cli
features: postgres
diff --git a/.github/workflows/conventional-commit-check.yml b/.github/workflows/conventional-commit-check.yml
index 0f1a16e99f..174287c61c 100644
--- a/.github/workflows/conventional-commit-check.yml
+++ b/.github/workflows/conventional-commit-check.yml
@@ -45,7 +45,7 @@ jobs:
with:
toolchain: stable
- - uses: baptiste0928/[email protected]
+ - uses: baptiste0928/[email protected]
with:
crate: cocogitto
diff --git a/.github/workflows/migration-check.yaml b/.github/workflows/migration-check.yaml
index 201209c3e3..57d1f579da 100644
--- a/.github/workflows/migration-check.yaml
+++ b/.github/workflows/migration-check.yaml
@@ -47,7 +47,7 @@ jobs:
with:
toolchain: stable
- - uses: baptiste0928/[email protected]
+ - uses: baptiste0928/[email protected]
with:
crate: diesel_cli
features: postgres
diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml
index a43f657d9e..70e5cf9aa8 100644
--- a/.github/workflows/release-new-version.yml
+++ b/.github/workflows/release-new-version.yml
@@ -35,20 +35,54 @@ jobs:
toolchain: stable
- name: Install cocogitto
- uses: baptiste0928/[email protected]
+ uses: baptiste0928/[email protected]
with:
crate: cocogitto
version: 5.4.0
+ - name: Install git-cliff
+ uses: baptiste0928/[email protected]
+ with:
+ crate: git-cliff
+ version: 1.2.0
+
+ - name: Install changelog-gh-usernames
+ uses: baptiste0928/[email protected]
+ with:
+ crate: changelog-gh-usernames
+ git: https://github.com/SanchithHegde/changelog-gh-usernames
+ rev: dab6da3ff99dbbff8650c114984c4d8be5161ac8
+
+ - name: Obtain previous and new tag information
+ shell: bash
+ # Only consider tags on current branch when setting PREVIOUS_TAG
+ run: |
+ echo "PREVIOUS_TAG=$(git tag --sort='version:refname' --merged | tail --lines 1)" >> $GITHUB_ENV
+ echo "NEW_TAG=$(cog bump --auto --dry-run)" >> $GITHUB_ENV
+
- name: Update changelog and create tag
shell: bash
+ if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }}
run: |
- git config --local user.name 'github-actions[bot]'
+ git config --local user.name 'github-actions'
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
cog bump --auto
- name: Push created commit and tag
shell: bash
+ if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }}
run: |
git push
git push --tags
+
+ - name: Generate release notes and create GitHub release
+ shell: bash
+ if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }}
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ GH_TOKEN: ${{ secrets.AUTO_RELEASE_PAT }}
+ # Need to consider commits inclusive of previous tag to generate diff link between versions.
+ # This would also then require us to remove the last few lines from the changelog.
+ run: |
+ git-cliff --config .github/git-cliff-release.toml "${PREVIOUS_TAG}^..${NEW_TAG}" | changelog-gh-usernames | head --lines -8 > release-notes.md
+ gh release create "${NEW_TAG}" --notes-file release-notes.md --verify-tag --title "Hyperswitch ${NEW_TAG}"
diff --git a/cog.toml b/cog.toml
index b42ec04664..a35bacf9db 100644
--- a/cog.toml
+++ b/cog.toml
@@ -1,5 +1,4 @@
tag_prefix = "v"
-branch_whitelist = ["main"]
ignore_merge_commits = true
# the HTML comments (`<!-- N -->`) are a workaround to have sections in custom order, since they are alphabetically sorted