From 5d2b9a1f4f5d8f218faa7f415695c09b4d9b6553 Mon Sep 17 00:00:00 2001 From: Sam Odukoya Date: Sat, 18 Nov 2023 16:09:25 +0000 Subject: [PATCH] feat: add support for auto semantic release --- .github/workflows/semantic-release.yml | 30 +++++++++++++++++++++ default-release-config.json | 36 ++++++++++++++++++++++++++ package.json | 9 +++++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/semantic-release.yml create mode 100644 default-release-config.json create mode 100644 package.json diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml new file mode 100644 index 0000000..ab754d7 --- /dev/null +++ b/.github/workflows/semantic-release.yml @@ -0,0 +1,30 @@ +name: Create Release + +on: + push: + branches: [ master ] + +jobs: + + create-release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + + - name: Install dependencies + run: npm install --no-save + + - name: Release + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release -e ./default-release-config.json -b master diff --git a/default-release-config.json b/default-release-config.json new file mode 100644 index 0000000..e443684 --- /dev/null +++ b/default-release-config.json @@ -0,0 +1,36 @@ +module.exports = { + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "presetConfig": {}, + "releaseRules": [ + { + "type": "refactor", + "release": "patch" + } + ] + } + ], + "@semantic-release/github", + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "writerOpts": { + "commitsSort": [ + "type", + "scope" + ] + } + } + ], + [ + "@semantic-release/exec", + { + "successCmd": "echo new-release-version=${ nextRelease.version } >> $GITHUB_OUTPUT" + } + ] + ] +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..5cde10b --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "go-novu", + "version": "0.0.1", + "dependencies": { + "semantic-release": "^19.0.2", + "@semantic-release/exec": "^6.0.3", + "conventional-changelog-conventionalcommits": "^4.6.3" + } +} \ No newline at end of file