Skip to content

Commit f9a114f

Browse files
committed
feat: update things
Signed-off-by: Carlos Alexandro Becker <[email protected]>
1 parent 45b3333 commit f9a114f

File tree

4 files changed

+170
-104
lines changed

4 files changed

+170
-104
lines changed

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
time: "08:00"
8+
labels:
9+
- "dependencies"
10+
commit-message:
11+
prefix: "chore"
12+
include: "scope"
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "daily"
17+
time: "08:00"
18+
labels:
19+
- "dependencies"
20+
commit-message:
21+
prefix: "chore"
22+
include: "scope"
23+
- package-ecosystem: "docker"
24+
directory: "/"
25+
schedule:
26+
interval: "daily"
27+
time: "08:00"
28+
labels:
29+
- "dependencies"
30+
commit-message:
31+
prefix: "chore"
32+
include: "scope"

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v3
14+
with:
15+
go-version: stable
16+
- run: go test -v ./...
17+
dependabot:
18+
needs: [build]
19+
runs-on: ubuntu-latest
20+
permissions:
21+
pull-requests: write
22+
contents: write
23+
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
24+
steps:
25+
- id: metadata
26+
uses: dependabot/fetch-metadata@v2
27+
with:
28+
github-token: "${{ secrets.GITHUB_TOKEN }}"
29+
- run: |
30+
gh pr review --approve "$PR_URL"
31+
gh pr merge --squash --auto "$PR_URL"
32+
env:
33+
PR_URL: ${{github.event.pull_request.html_url}}
34+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/nightly.yml renamed to .github/workflows/release.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: goreleaser-nightly
1+
name: goreleaser
22

33
on:
44
workflow_dispatch:
55
push:
6-
tags: ['v*']
6+
tags: ["v*"]
77

88
permissions:
99
contents: write
@@ -36,30 +36,30 @@ jobs:
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737
- uses: actions/setup-go@v3
3838
with:
39-
go-version: 1.19
40-
cache: true
39+
go-version: stable
40+
- if: ${{ github.event_name == 'workflow_dispatch' }}
41+
shell: bash
42+
run: |
43+
echo "flags=--nightly" >> $GITHUB_ENV
4144
- shell: bash
4245
run: |
4346
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
4447
- uses: actions/[email protected]
4548
if: matrix.os == 'ubuntu-latest'
4649
with:
4750
path: dist/linux
48-
key: linux-${{ env.sha_short }}
51+
key: linux-${{ env.sha_short }}${{ env.flags }}
4952
- uses: actions/[email protected]
5053
if: matrix.os == 'macos-latest'
5154
with:
5255
path: dist/darwin
53-
key: darwin-${{ env.sha_short }}
56+
key: darwin-${{ env.sha_short }}${{ env.flags }}
5457
- uses: actions/[email protected]
5558
if: matrix.os == 'windows-latest'
5659
with:
5760
path: dist/windows
58-
key: windows-${{ env.sha_short }}
61+
key: windows-${{ env.sha_short }}${{ env.flags }}
5962
enableCrossOsArchive: true
60-
- if: ${{ github.event_name == 'workflow_dispatch' }}
61-
shell: bash
62-
run: echo "flags=--nightly" >> $GITHUB_ENV
6363
- uses: goreleaser/goreleaser-action@v4
6464
with:
6565
distribution: goreleaser-pro
@@ -73,6 +73,7 @@ jobs:
7373
needs: prepare
7474
env:
7575
DOCKER_CLI_EXPERIMENTAL: "enabled"
76+
flags: ""
7677
steps:
7778
- uses: actions/checkout@v3
7879
with:
@@ -89,28 +90,30 @@ jobs:
8990
password: ${{ secrets.GITHUB_TOKEN }}
9091
- uses: actions/setup-go@v3
9192
with:
92-
go-version: 1.19
93-
cache: true
93+
go-version: stable
9494

9595
# copy the cashes from prepare
96+
- if: ${{ github.event_name == 'workflow_dispatch' }}
97+
shell: bash
98+
run: |
99+
echo "flags=--nightly" >> $GITHUB_ENV
96100
- shell: bash
97101
run: |
98102
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
99103
- uses: actions/[email protected]
100104
with:
101105
path: dist/linux
102-
key: linux-${{ env.sha_short }}
106+
key: linux-${{ env.sha_short }}${{ env.flags }}
103107
- uses: actions/[email protected]
104108
with:
105109
path: dist/darwin
106-
key: darwin-${{ env.sha_short }}
110+
key: darwin-${{ env.sha_short }}${{ env.flags }}
107111
- uses: actions/[email protected]
108112
with:
109113
path: dist/windows
110-
key: windows-${{ env.sha_short }}
114+
key: windows-${{ env.sha_short }}${{ env.flags }}
111115
enableCrossOsArchive: true
112116

113-
114117
# release
115118
- uses: goreleaser/goreleaser-action@v4
116119
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit

.goreleaser.yaml

Lines changed: 85 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,48 @@
44
#
55
# This is an example-real .goreleaser.yml file with some sensible defaults.
66
# Make sure to check the documentation at https://goreleaser.com
7+
version: 2
78
before:
89
hooks:
910
- go mod tidy
11+
1012
builds:
11-
- targets: [go_first_class]
12-
mod_timestamp: '{{ .CommitTimestamp }}'
13-
flags:
14-
# trims path
15-
- -trimpath
16-
ldflags:
17-
# use commit date instead of current date as main.date
18-
# only needed if you actually use those things in your main package, otherwise can be ignored.
19-
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
13+
- targets: [go_first_class]
14+
mod_timestamp: "{{ .CommitTimestamp }}"
15+
flags:
16+
# trims path
17+
- -trimpath
18+
ldflags:
19+
# use commit date instead of current date as main.date
20+
# only needed if you actually use those things in your main package, otherwise can be ignored.
21+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
22+
2023
checksum:
21-
name_template: 'checksums.txt'
24+
name_template: "checksums.txt"
25+
2226
snapshot:
23-
name_template: "{{ incpatch .Version }}-next"
27+
version_template: "{{ incpatch .Version }}-next"
28+
2429
changelog:
2530
sort: asc
2631
filters:
2732
exclude:
28-
- '^docs:'
29-
- '^test:'
33+
- "^docs:"
34+
- "^test:"
3035

3136
nfpms:
32-
- file_name_template: '{{ .ConventionalFileName }}'
33-
homepage: https://goreleaser.com
34-
description: Just another example
35-
maintainer: Carlos Alexandro Becker <[email protected]>
36-
license: MIT
37-
vendor: GoReleaser
38-
bindir: /usr/bin
39-
section: utils
40-
formats: [apk, deb, rpm]
37+
- file_name_template: "{{ .ConventionalFileName }}"
38+
homepage: https://goreleaser.com
39+
description: Just another example
40+
maintainer: Carlos Alexandro Becker <[email protected]>
41+
license: MIT
42+
vendor: GoReleaser
43+
bindir: /usr/bin
44+
section: utils
45+
formats: [apk, deb, rpm]
4146

4247
release:
43-
name_template: 'v{{ .Version }}'
48+
name_template: "v{{ .Version }}"
4449
footer: |
4550
* * *
4651
@@ -50,39 +55,37 @@ release:
5055
Want to help? You can [sponsor](https://goreleaser.com/sponsors/),get a [Pro License](https://goreleaser.com/pro) or [contribute](https://goreleaser.com/contributing).
5156
Also, feel free to reach out on [Discord](https://discord.gg/RGEBtg8vQ6) and [Twitter](https://twitter.com/goreleaser)!
5257
53-
5458
nightly:
5559
publish_release: true
5660
keep_single_release: true
57-
name_template: '{{ incminor .Version }}-nightly'
61+
version_template: "{{ incminor .Version }}-nightly"
5862
tag_name: nightly
5963

60-
6164
dockers:
62-
- image_templates:
63-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64'
64-
build_flag_templates:
65-
- "--pull"
66-
- "--label=org.opencontainers.image.description=Just an example-real"
67-
- "--label=org.opencontainers.image.created={{.Date}}"
68-
- "--label=org.opencontainers.image.name={{.ProjectName}}"
69-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
70-
- "--label=org.opencontainers.image.version={{.Version}}"
71-
- "--label=org.opencontainers.image.source={{.GitURL}}"
72-
- "--platform=linux/amd64"
73-
use: buildx
74-
- image_templates:
75-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64'
76-
build_flag_templates:
77-
- "--pull"
78-
- "--label=org.opencontainers.image.description=Just an example-real"
79-
- "--label=org.opencontainers.image.created={{.Date}}"
80-
- "--label=org.opencontainers.image.name={{.ProjectName}}"
81-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
82-
- "--label=org.opencontainers.image.version={{.Version}}"
83-
- "--label=org.opencontainers.image.source={{.GitURL}}"
84-
- "--platform=linux/arm64"
85-
use: buildx
65+
- image_templates:
66+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64"
67+
build_flag_templates:
68+
- "--pull"
69+
- "--label=org.opencontainers.image.description=Just an example-real"
70+
- "--label=org.opencontainers.image.created={{.Date}}"
71+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
72+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
73+
- "--label=org.opencontainers.image.version={{.Version}}"
74+
- "--label=org.opencontainers.image.source={{.GitURL}}"
75+
- "--platform=linux/amd64"
76+
use: buildx
77+
- image_templates:
78+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64"
79+
build_flag_templates:
80+
- "--pull"
81+
- "--label=org.opencontainers.image.description=Just an example-real"
82+
- "--label=org.opencontainers.image.created={{.Date}}"
83+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
84+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
85+
- "--label=org.opencontainers.image.version={{.Version}}"
86+
- "--label=org.opencontainers.image.source={{.GitURL}}"
87+
- "--platform=linux/arm64"
88+
use: buildx
8689
# - image_templates:
8790
# - 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-windows-amd64'
8891
# build_flag_templates:
@@ -98,36 +101,32 @@ dockers:
98101
# dockerfile: windows.dockerfile
99102

100103
docker_manifests:
101-
- name_template: 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}'
102-
image_templates:
103-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64'
104-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64'
105-
# - 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-windows-amd64'
106-
- name_template: '{{ if not .IsNightly }}ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:latest{{ end }}'
107-
image_templates:
108-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64'
109-
- 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64'
110-
# - 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-windows-amd64'
111-
112-
monorepo:
113-
tag_prefix: v # so it always filters out the nightly tag
114-
104+
- name_template: "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}"
105+
image_templates:
106+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64"
107+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64"
108+
# - 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-windows-amd64'
109+
- name_template: "{{ if not .IsNightly }}ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:latest{{ end }}"
110+
image_templates:
111+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-amd64"
112+
- "ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-arm64"
113+
# - 'ghcr.io/caarlos0/goreleaser-pro-split-merge-example-real:v{{ .Version }}-windows-amd64'
115114

116115
# signs the checksum file
117116
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
118117
# https://goreleaser.com/customization/sign
119118
signs:
120-
- cmd: cosign
121-
env:
122-
- COSIGN_EXPERIMENTAL=1
123-
certificate: '${artifact}.pem'
124-
args:
125-
- sign-blob
126-
- '--output-certificate=${certificate}'
127-
- '--output-signature=${signature}'
128-
- '${artifact}'
129-
artifacts: checksum
130-
output: true
119+
- cmd: cosign
120+
env:
121+
- COSIGN_EXPERIMENTAL=1
122+
certificate: "${artifact}.pem"
123+
args:
124+
- sign-blob
125+
- "--output-certificate=${certificate}"
126+
- "--output-signature=${signature}"
127+
- "${artifact}"
128+
artifacts: checksum
129+
output: true
131130

132131
# create a source tarball
133132
# https://goreleaser.com/customization/source/
@@ -137,20 +136,18 @@ source:
137136
# creates SBOMs of all archives and the source tarball using syft
138137
# https://goreleaser.com/customization/sbom
139138
sboms:
140-
- artifacts: archive
141-
- id: source # Two different sbom configurations need two different IDs
142-
artifacts: source
139+
- artifacts: archive
140+
- id: source # Two different sbom configurations need two different IDs
141+
artifacts: source
143142

144143
# signs our docker image
145144
# https://goreleaser.com/customization/docker_sign
146145
docker_signs:
147-
- cmd: cosign
148-
env:
149-
- COSIGN_EXPERIMENTAL=1
150-
artifacts: images
151-
output: true
152-
args:
153-
- 'sign'
154-
- '${artifact}'
155-
156-
146+
- cmd: cosign
147+
env:
148+
- COSIGN_EXPERIMENTAL=1
149+
artifacts: images
150+
output: true
151+
args:
152+
- "sign"
153+
- "${artifact}"

0 commit comments

Comments
 (0)