From 226cc94bf2a0696157f395e5144f53cef91d2f56 Mon Sep 17 00:00:00 2001 From: Alexander Goussas <84427521+aloussase@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:08:21 -0500 Subject: [PATCH] chore: Add semantic release config (#199) * chore: Include releaserc file * chore(ci): Remove version from cabal file * fix(ci): Remove unused branch from releaserc file --- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ .releaserc | 18 +++++++++++++++++ dotenv.cabal | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3f33363 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release +on: + push: + branches: + - main +jobs: + release: + name: "Release" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + # Workaround for issue: https://github.com/cycjimmy/semantic-release-action/issues/159 + # Had to pin to version 14 + - name: "Pin node version" + uses: actions/setup-node@v2 + with: + node-version: '14' + # Use haskell environment to run cabal configure needed for semantic-release-hackage + - name: Setup Haskell + id: setup-haskell-cabal + uses: haskell-actions/setup@v2 + with: + ghc-version: "9.0" + cabal-version: "3.8" + - name: Semantic Release + run: cabal configure --enable-tests + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + with: + extra_plugins: | + @semantic-release/commit-analyzer + @semantic-release/release-notes-generator + @semantic-release/github + semantic-release-hackage@1.1.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HACKAGE_TOKEN: ${{ secrets.HACKAGE_TOKEN }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..b5bfc69 --- /dev/null +++ b/.releaserc @@ -0,0 +1,18 @@ +{ + "$schema": "https://json.schemastore.org/semantic-release", + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "semantic-release-hackage", + { + "packageName": "dotenv", + "versionPrefix": "0.", + "publishDocumentation": true + } + ], + "@semantic-release/github" + ], + "tagFormat": "v0.${version}" +} diff --git a/dotenv.cabal b/dotenv.cabal index 1232a7e..d07697a 100644 --- a/dotenv.cabal +++ b/dotenv.cabal @@ -1,5 +1,5 @@ name: dotenv -version: 0.12.0.0 +version: 0.0.0.0 synopsis: Loads environment variables from dotenv files homepage: https://github.com/stackbuilders/dotenv-hs description: