Skip to content

Commit

Permalink
Rework build system
Browse files Browse the repository at this point in the history
goreleaser will now be utilized to build and ship releases, as well as
ensure consistent builds for intermediate commits and pull requests.
  • Loading branch information
mckern committed Jan 19, 2024
1 parent 30a32f2 commit 8c534e2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 11 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build

on:
pull_request:
push:

permissions:
contents: read

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- name: build golines
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: build --clean --snapshot --single-target
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: golangci-lint
name: lint
on:
push:
branches:
Expand All @@ -11,15 +11,15 @@ permissions:

jobs:
golangci:
name: lint
name: golines lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- name: golangci-lint
- name: run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- name: release golines
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/go.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: golines test
name: test
on:
push:
branches:
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
export GO111MODULE=on

.PHONY: all
all: install test

.PHONY: install
install:
go install .
all: build test

.PHONY: build
build:
go build .
goreleaser build --clean --snapshot --single-target

.PHONY: test
test: vet
Expand Down

0 comments on commit 8c534e2

Please sign in to comment.