Skip to content

Commit 68e9c29

Browse files
committed
Update CI/CD pipelines
1 parent 6e3c789 commit 68e9c29

File tree

4 files changed

+82
-23
lines changed

4 files changed

+82
-23
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
LICENSE.md
44
README.md
55
docs
6-
.github
6+
.github
7+
.goreleaser.yaml

.github/workflows/go.yml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,4 @@ jobs:
1919
go-version: 1.19
2020

2121
- name: Build
22-
run: go build -v ./...
23-
24-
ci:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v3
28-
- name: Build image
29-
run: |
30-
# Login dockerhub
31-
pwd="${{ secrets.dockerhub }}"
32-
docker login -u="plazzari" -p="${pwd}"
33-
34-
# Get version
35-
VERSION=$(awk -F '[="]' '/^const version/ {print $3}' cmd/core.go)
36-
37-
# Build docker images
38-
docker build . --tag "plazzari/play:${VERSION}"
39-
docker tag "plazzari/play:${VERSION}" plazzari/play:latest
40-
41-
# Deploy docker images
42-
docker push "plazzari/play:${VERSION}"
43-
docker push plazzari/play:latest
22+
run: go build -v ./...

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/[email protected]
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: "stable"
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/[email protected]
27+
with:
28+
version: latest
29+
args: release --clean
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
32+
33+
docker:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Build and release docker image
38+
run: |
39+
# Login dockerhub
40+
pwd="${{ secrets.dockerhub }}"
41+
docker login -u="plazzari" -p="${pwd}"
42+
43+
# Get version
44+
VERSION=$(awk -F '[="]' '/^const version/ {print $3}' cmd/core.go)
45+
46+
# Build docker images
47+
docker build . --tag "plazzari/play:${VERSION}"
48+
docker tag "plazzari/play:${VERSION}" plazzari/play:latest
49+
50+
# Deploy docker images
51+
docker push "plazzari/play:${VERSION}"
52+
docker push plazzari/play:latest

.goreleaser.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
goos:
8+
- linux
9+
- windows
10+
- darwin
11+
archives:
12+
- format: zip
13+
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'
14+
checksum:
15+
name_template: 'checksums.txt'
16+
snapshot:
17+
name_template: "{{ incpatch .Version }}-next"
18+
changelog:
19+
sort: asc
20+
filters:
21+
exclude:
22+
- '.*Docker.*'
23+
- '.*README.*'
24+
- '.*[Dd]ocumentation.*'
25+
- '.*[Pp]ipelines.*'
26+
- '.*gitignore.*'
27+
- '.*dockerignore.*'

0 commit comments

Comments
 (0)