Skip to content

Commit

Permalink
ci(release): setup automated releases (#133)
Browse files Browse the repository at this point in the history
Automate releases with release-please.
  • Loading branch information
mloberg authored Oct 25, 2024
1 parent 8874c67 commit abcfddb
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 8 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@ name: Release

on:
push:
tags:
- 'v*'
branches:
- main

jobs:
goreleaser:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_PRIVATE_KEY }}
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.token.outputs.token }}
skip-github-pull-request: "${{ contains(github.event.head_commit.message, 'chore: release') }}"
outputs:
released: ${{ steps.release.outputs.release_created }}
publish:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.released
steps:
- uses: actions/checkout@v4
with:
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@ signs:
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
draft: true
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "2.1.13"
}
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,27 @@ A Terraform Provider for [Oh Dear](https://ohdear.app/).
The provider requires an `api_token` (or `OHDEAR_TOKEN` environment variable) and
an optional `team_id` (`OHDEAR_TEAM_ID` environment variable).

```terraform
<!-- x-release-please-start-version -->
```hcl
terraform {
required_providers {
ohdear = {
source = "articulate/ohdear"
version = "2.1.13"
}
}
}
provider "ohdear" {
api_token = "my-api-token"
team_id = 1234 # optional
}
```
<!-- x-release-please-end -->

To add a site to Oh Dear, create a `ohdear_site` resource.

```terraform
```hcl
resource "ohdear_site" "test" {
url = "https://site.iwanttomonitor.com"
}
Expand All @@ -25,7 +36,7 @@ resource "ohdear_site" "test" {
By default, all checks are enabled. You can customize this using the `checks`
block. Any checks not defined in the block are disabled.

```terraform
```hcl
resource "ohdear_site" "test" {
url = "https://site.iwanttomonitor.com"
Expand All @@ -40,3 +51,15 @@ resource "ohdear_site" "test" {
* [Go](https://golang.org/doc/install) (for development)
* [golangci-lint](https://golangci-lint.run/)
* [GoReleaser](https://goreleaser.com/)

## Contributing

Commit messages must be signed and follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
format.

## Publishing

Releases are automatically created by [release-please](https://github.com/googleapis/release-please)
on PR merge. This will scan commit messages for new releases based on commit message
and create a release PR. To finish the release, merge the PR, which will kick off
GoReleaser.
29 changes: 29 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"pull-request-title-pattern": "chore: release ${version}",
"pull-request-header": ":robot: I detected a new release. Please review the changes below.",
"pull-request-footer": "When you are ready to release these changes, merge this PR.",
"changelog-sections": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "revert", "section": "Reverts" },
{ "type": "deps", "section": "Dependency Updates" },
{ "type": "docs", "section": "Documentation", "hidden": true },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous", "hidden": true },
{ "type": "refactor", "section": "Refactors", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
],
"packages": {
".": {
"release-type": "go",
"draft": true,
"extra-files": ["README.md"]
}
}
}

0 comments on commit abcfddb

Please sign in to comment.