Skip to content

Commit

Permalink
chore(actions): #420 update release process with release-please (#421)
Browse files Browse the repository at this point in the history
* chore(actions): add release-please.yaml and initial config

* chore(actions): add release please manifest with current lula version

* chore(actions): set gorelease draft to false

* chore(actions): add PR title linting for conventional commits

* chore(actions): #420 add commitlint config

* chore(docs): update release-process docs with new implementation

* chore(actions): add the release-please-config.json from go-oscal
  • Loading branch information
mike-winberry authored May 20, 2024
1 parent d1abbcc commit a372df0
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 34 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ release:
name: lula
prerelease: auto
mode: append
draft: true
draft: false
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.2.1"
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
37 changes: 4 additions & 33 deletions docs/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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?

Expand All @@ -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)
Expand Down
28 changes: 28 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
}
}

0 comments on commit a372df0

Please sign in to comment.