diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100644 index 00000000..adfc6830 --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,27 @@ +name: PR Title Check + +on: + pull_request: + branches: [main] + types: [opened, edited, synchronize] + +jobs: + title_check: + runs-on: ubuntu-latest + permissions: + pull-requests: read + + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + + - name: Install commitlint + run: npm install --save-dev @commitlint/{config-conventional,cli} + + - name: Lint PR title + run: echo "${{ github.event.pull_request.title }}" | npx commitlint \ No newline at end of file diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 00000000..d35d86d9 --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,18 @@ +name: Lula Draft Release(please) + +on: + push: + branches: + - main + +jobs: + tag-new-version: + name: Tag New Version + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Create release tag + id: tag + uses: googleapis/release-please-action@f3969c04a4ec81d7a9aa4010d84ae6a7602f86a7 \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ba61e909..adb5fe51 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -49,4 +49,4 @@ release: name: lula prerelease: auto mode: append - draft: true + draft: false diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..63065011 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.2.1" +} \ No newline at end of file diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..8567d51d --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ["@commitlint/config-conventional"] }; \ No newline at end of file diff --git a/docs/release-process.md b/docs/release-process.md index 37f55ff7..0dc64c6f 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -4,11 +4,11 @@ This document provides guidance on how to create Lula releases, address release ## Creating releases -This project uses [goreleaser](https://github.com/goreleaser/goreleaser-action) for releasing binaries. +This project uses [goreleaser](https://github.com/goreleaser/goreleaser-action) for releasing binaries and [release-please](https://github.com/marketplace/actions/release-please-action) for creating release PR's. ### How should I write my commits? -We use conventional commit messages [Conventional Commit messages](https://www.conventionalcommits.org/). +We use conventional commit messages [Conventional Commit messages](https://www.conventionalcommits.org/). The most important prefixes you should have in mind are: @@ -20,15 +20,8 @@ The most important prefixes you should have in mind are: ### How can I influence the version number for a release? -To trigger the goreleaser action you push a signed tag using your GPG key. - -```console -git tag -s vX.X.X -m "Release Commit Message" - -git push origin vX.X.X -``` - -Goreleaser can also be triggered by cutting the release manually through GitHub. Following the GitHub [release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) documentation and using a semver version number IE. vX.X.X +PR titles should also follow this pattern and are linted using [commitlint](https://commitlint.js.org/). The PR title will determine the version bump. When a PR is merged (squashed) release-please will kick off a release PR. When that release PR is approved and merged, release-please will create a draft release. Once that draft release is published go-releaser with build and publish the assets. +* Pre-v1.0.0 release-please is configured to bump minors on breaking changes and patches otherwise. per [release-please-config](../release-please-config.json) ### How do I fix a release issue? @@ -47,28 +40,6 @@ The CHANGELOG is not required to be updated, only the release notes must be upda >PLEASE USE A NEWER VERSION (there are known issues with this release) ``` -#### Incorrect Tag or Remove a Tag - -In the event a release is tagged incorrectly and it needs to be changed this can be completed by someone with admin privileges in the repo by running the following commands: - -```console -git tag -d vX.X.X - -git tag -s vX.X.X - -git push origin vX.X.X --force -``` - -These commands will delete the tag locally, create a new signed tag version, lastly force push the new tag to origin. - -In the event a tag needs deleted and NOT replaced this can be completed by someone with admin privileges in the repo by running the following commands: - -```console -git tag -d vX.X.X - -git push origin :refs/tags/vX.X.X -``` - #### Other issues and helpful tips - Confirm that the goreleaser configuration is valid by using the [goreleaser cli](https://goreleaser.com/cmd/goreleaser_check/?h=valid) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..5f600b20 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,28 @@ +{ + "packages": { + ".": { + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "release-type": "go", + "draft": true, + "changelog-path": "CHANGELOG.md", + "changelog-sections": [ + { + "type": "feat", + "section": "Features", + "hidden": false + }, + { + "type": "fix", + "section": "Bug Fixes", + "hidden": false + }, + { + "type": "chore", + "section": "Miscellaneous", + "hidden": false + } + ] + } + } +} \ No newline at end of file