Skip to content

Commit cdfa281

Browse files
authored
Improve CI builds
1 parent ea79dcc commit cdfa281

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,21 @@ on:
44
push:
55
branches:
66
- '*'
7+
pull_request:
8+
branches:
9+
- '*'
710

811
jobs:
912
ci-build:
1013
runs-on: ubuntu-latest
1114
steps:
15+
- uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.14
1218
- uses: actions/checkout@v2
19+
- uses: actions/cache@v2
20+
with:
21+
path: ~/go/pkg/mod
22+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
1323
- name: Build
14-
run: make docker run="make all"
24+
run: make all

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ name: release
33
on:
44
push:
55
tags:
6-
- '*'
6+
- 'v*'
77

88
jobs:
99
goreleaser:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- name: Unshallow
14-
run: git fetch --prune --unshallow
15-
- name: Release
16-
run: make docker args="-e CI -e GITHUB_TOKEN" run="make all publish"
13+
- run: git fetch --prune --unshallow
14+
- uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.14
17+
- uses: goreleaser/goreleaser-action@v2
18+
with:
19+
version: v0.137.0
20+
args: release --rm-dist
1721
env:
1822
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.PHONY: all
44
all: ## full build
5-
all: clean install build fmt lint test release
5+
all: install build fmt lint test release
66

77
.PHONY: dev
88
dev: ## fast build
@@ -48,12 +48,6 @@ release: ## goreleaser --snapshot --skip-publish --rm-dist
4848
$(call print-target)
4949
goreleaser --snapshot --skip-publish --rm-dist
5050

51-
.PHONY: publish
52-
publish:
53-
$(call print-target)
54-
@test -n "$(CI)" || (echo "$@ should be running only on CI Server" && exit 1)
55-
goreleaser --rm-dist
56-
5751
.PHONY: docker
5852
docker: ## run in golang container, example: make docker run="make all"
5953
docker run --rm -v $(CURDIR):/app $(args) golang:1.14 sh -c "cd /app && $(run)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ It includes:
3636

3737
### Maintainance
3838

39-
Remember to update Go version in [Makefile](Makefile) and [devcontainer.json](.devcontainer/devcontainer.json).
39+
Remember to update Go version in [.github/workflows](.github/workflows), [Makefile](Makefile) and [devcontainer.json](.devcontainer/devcontainer.json).
4040

4141
Notable files:
4242
- [devcontainer.json](.devcontainer/devcontainer.json) - Visual Studio Code Remote Container configuration

0 commit comments

Comments
 (0)