Skip to content

Commit 4fb931e

Browse files
authored
chore(actions): Switch to release-please and update workflows (#31)
Switch from release drafter to release please and update workflows.
1 parent c1b32e9 commit 4fb931e

11 files changed

Lines changed: 115 additions & 225 deletions

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ updates:
99
labels:
1010
- "dependencies"
1111
- "patch"
12+
groups:
13+
gomod-updates:
14+
update-types:
15+
- minor
16+
- patch
1217
- package-ecosystem: "github-actions"
1318
directory: "/"
1419
schedule:
@@ -18,3 +23,8 @@ updates:
1823
labels:
1924
- "dependencies"
2025
- "patch"
26+
groups:
27+
action-updates:
28+
update-types:
29+
- minor
30+
- patch

.github/release-drafter.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/check-pr.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Terraform Provider release workflow.
2+
name: Terraform Provider
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
goreleaser:
14+
name: Build and Publish
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version-file: 'go.mod'
26+
cache: true
27+
28+
- name: Import GPG key
29+
uses: crazy-max/ghaction-import-gpg@v6
30+
id: import_gpg
31+
with:
32+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
33+
passphrase: ${{ secrets.PASSPHRASE }}
34+
35+
- name: Run GoReleaser
36+
uses: goreleaser/goreleaser-action@v6
37+
with:
38+
version: '~> v2'
39+
args: release --clean
40+
env:
41+
# GitHub sets the GITHUB_TOKEN secret automatically.
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,19 @@
1-
# Terraform Provider release workflow.
21
name: Release
32

4-
# This GitHub action creates a release when a tag that matches the pattern
5-
# "v*" (e.g. v0.1.0) is created.
63
on:
74
push:
8-
tags:
9-
- 'v*'
5+
branches:
6+
- main
107

11-
# Releases need permissions to read and write the repository contents.
12-
# GitHub considers creating releases and uploading assets as writing contents.
138
permissions:
149
contents: write
10+
pull-requests: write
1511

1612
jobs:
17-
goreleaser:
13+
release-please:
1814
runs-on: ubuntu-latest
1915
steps:
20-
- uses: actions/checkout@v4
16+
- uses: googleapis/release-please-action@v4
2117
with:
22-
# Allow goreleaser to access older tag information.
23-
fetch-depth: 0
24-
- uses: actions/setup-go@v5
25-
with:
26-
go-version-file: 'go.mod'
27-
cache: true
28-
- name: Import GPG key
29-
uses: crazy-max/ghaction-import-gpg@v6
30-
id: import_gpg
31-
with:
32-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
33-
passphrase: ${{ secrets.PASSPHRASE }}
34-
- name: Run GoReleaser
35-
uses: goreleaser/goreleaser-action@v6
36-
with:
37-
args: release --clean
38-
env:
39-
# GitHub sets the GITHUB_TOKEN secret automatically.
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
18+
release-type: go
19+
token: ${{ secrets.CRU_DEVOPS_GITHUB_TOKEN }}

.github/workflows/semantic-pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
semantic-pr:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@v5
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ name: Tests
44
# This GitHub action runs your tests for each pull request.
55
on:
66
pull_request:
7-
branches:
8-
- main
7+
branches-ignore:
8+
- 'release-please*'
99

1010
# Testing only needs permissions to read the repository contents.
1111
permissions:
1212
contents: read
1313

1414
jobs:
15-
# Ensure project builds before running testing matrix
15+
# Ensure project builds before running tests
1616
build:
1717
name: Build
1818
runs-on: ubuntu-latest
@@ -25,10 +25,10 @@ jobs:
2525
cache: true
2626
- run: go mod download
2727
- run: go build -v .
28-
- name: Run linters
29-
uses: golangci/golangci-lint-action@v6
28+
- name: Run golangci-lint
29+
uses: golangci/golangci-lint-action@v7
3030
with:
31-
version: latest
31+
version: v2.0
3232
args: --tests=false
3333

3434
generate:

.github/workflows/update-changelog.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)