Skip to content

Commit

Permalink
ci: break apart gh workflow (#29)
Browse files Browse the repository at this point in the history
* ci: break apart gh workflow

Co-authored-by: Adriel Perkins <[email protected]>

* ci: rename PR workflows

Co-authored-by: Adriel Perkins <[email protected]>

---------

Co-authored-by: Adriel Perkins <[email protected]>
  • Loading branch information
pmpaulino and adrielp authored Jul 14, 2023
1 parent c27265f commit 7008b1e
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 87 deletions.
122 changes: 47 additions & 75 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,64 @@
name: Lint, Build, Test and Release
---
name: Build and Test

on:
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]

jobs:
lint:
strategy:
matrix:
go: ['1.19']
os: [ubuntu-latest, macos-latest]
matrix:
go: ['1.19']
os: [ubuntu-latest, macos-latest]
name: lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false

- name: Make install-tools
run: make install-tools
- name: Make install-tools
run: make install-tools

- name: Make lint-all
run: make lint-all
- name: Make lint-all
run: make lint-all

build:
strategy:
matrix:
go: ['1.19']
os: [ubuntu-latest, macos-latest]
name: build
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
strategy:
matrix:
go: ['1.19']
os: [ubuntu-latest, macos-latest]
name: build
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
cache: false
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
cache: false

- name: Make cibuild
run: make cibuild
- name: Make cibuild
run: make cibuild

go-semantic-release:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [lint, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Run go-semantic-release
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
changelog-generator-opt: "emojis=true"

goreleaser:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [go-semantic-release]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
needs: [lint, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Run go-semantic-release
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
changelog-generator-opt: emojis=true
5 changes: 2 additions & 3 deletions .github/workflows/pr_conventional.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Lint PR
name: PR Linter

on:
pull_request:
Expand All @@ -9,8 +9,7 @@ on:
- synchronize

jobs:
main:
name: Validate PR title (Convention Commit)
triage:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: PRs labeler
---
name: PR Labeler

on:
- pull_request_target
- pull_request_target

jobs:
triage:
runs-on: ubuntu-20.04
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
triage:
runs-on: ubuntu-20.04
steps:
- uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Release

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

jobs:
release:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7008b1e

Please sign in to comment.