Skip to content

Commit

Permalink
ci: Switch to release-please
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Nov 6, 2023
1 parent 7cdf6c1 commit 234b233
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 54 deletions.
20 changes: 0 additions & 20 deletions .github/release.yml

This file was deleted.

46 changes: 19 additions & 27 deletions .github/workflows/main.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,56 @@
---
name: build
name: Build
on:
push:
tags:
- v*
branches:
- main
- master
pull_request:
permissions:
contents: write
pull-requests: read
branches:
- main
workflow_dispatch:
schedule:
- cron: 0 0 * * 1

jobs:
build:
test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- '1.19'
- '1.20'

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
if: github.event_name == 'pull_request'
with:
only-new-issues: true

- name: Test
run: go test -v -coverprofile=cover.out ./...

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: cover.out
flag-name: Go-${{ matrix.go }}
parallel: true

finish:
needs: build
needs: test
runs-on: ubuntu-latest

steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Run GoReleaser
uses: goreleaser/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint pull request

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
if: always() && steps.lint_pr_title.outputs.error_message != null
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
- uses: marocchino/sticky-pull-request-comment@v2
if: steps.lint_pr_title.outputs.error_message == null
with:
header: pr-title-lint-error
delete: true
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Track releases

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest

steps:
- name: Run release-please
uses: google-github-actions/release-please-action@v3
with:
command: manifest
token: ${{ secrets.RELEASE_TOKEN }}
7 changes: 0 additions & 7 deletions .goreleaser.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.4.3"
}
6 changes: 6 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": {
".": {}
},
"release-type": "go"
}

0 comments on commit 234b233

Please sign in to comment.