Skip to content

Commit 164f235

Browse files
authored
chore(ci): rework ci for ghcr (#7)
1 parent 7a3b8df commit 164f235

File tree

3 files changed

+126
-30
lines changed

3 files changed

+126
-30
lines changed

.github/workflows/ci.yaml

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
name: Build and Test
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
74
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review]
86
branches:
9-
- '*'
7+
- 'main'
8+
9+
permissions:
10+
contents: write
1011

1112
jobs:
1213
build:
14+
if: "!github.event.pull_request.draft"
1315
strategy:
1416
matrix:
1517
os: [ubuntu-latest, macOS-latest, windows-latest]
1618
runs-on: ${{ matrix.os }}
1719
name: Build & Test
1820
steps:
19-
-
20-
name: Checkout
21-
uses: actions/checkout@v2
22-
-
23-
name: Setup go
24-
uses: actions/setup-go@v2
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup go
25+
uses: actions/setup-go@v5
2526
with:
2627
go-version: '^1.16.0'
27-
-
28-
name: Download dependencies
28+
29+
- name: Download dependencies
2930
run: go mod download
30-
-
31-
name: Build & Test
31+
32+
- name: Build & Test
3233
run: |
3334
go build -o ./helm-changelog -v ./cmd/
3435
go test ./...
35-
-
36-
name: Run GoReleaser
37-
uses: goreleaser/goreleaser-action@v2
38-
with:
39-
args: release --snapshot --skip-publish --rm-dist

.github/workflows/release-executable.yaml .github/workflows/release.yaml

+14-11
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@ on:
55
tags:
66
- v*.*.*
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
812
jobs:
913
build:
1014
runs-on: ubuntu-latest
1115
name: goreleaser
1216
steps:
13-
-
14-
name: Checkout
15-
uses: actions/checkout@v2
17+
- name: Checkout
18+
uses: actions/checkout@v4
1619
with:
1720
fetch-depth: 0
18-
-
19-
name: Setup go
20-
uses: actions/setup-go@v2
21+
22+
- name: Setup go
23+
uses: actions/setup-go@v5
2124
with:
2225
go-version: '^1.16.0'
23-
-
24-
name: Download dependencies
26+
27+
- name: Download dependencies
2528
run: go mod download
26-
-
27-
name: Release via goreleaser
28-
uses: goreleaser/goreleaser-action@v2
29+
30+
- name: Release via goreleaser
31+
uses: goreleaser/goreleaser-action@v5
2932
with:
3033
args: release --rm-dist
3134
env:

.goreleaser.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
project_name: helm-changelog
2+
3+
builds:
4+
- binary: helm-changelog
5+
main: ./
6+
7+
env:
8+
- CGO_ENABLED=0
9+
flags:
10+
- -trimpath
11+
ldflags:
12+
- -s -w -X main.version={{.Version}}
13+
14+
goos:
15+
- windows
16+
- darwin
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm64
21+
22+
changelog:
23+
sort: asc
24+
filters:
25+
exclude:
26+
- '^docs:'
27+
- '^doc:'
28+
- '^chore:'
29+
- '^test:'
30+
- '^tests:'
31+
32+
archives:
33+
- id: helm-changelog
34+
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
35+
format: tar.gz
36+
format_overrides:
37+
- goos: windows
38+
format: zip
39+
files:
40+
- LICENSE
41+
42+
docker_manifests:
43+
- name_template: 'ghcr.io/traefik/helm-changelog:{{ .Tag }}'
44+
image_templates:
45+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-amd64'
46+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-arm64'
47+
- name_template: 'ghcr.io/traefik/helm-changelog:latest'
48+
image_templates:
49+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-amd64'
50+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-arm64'
51+
- name_template: 'ghcr.io/traefik/helm-changelog:v{{ .Major }}.{{ .Minor }}'
52+
image_templates:
53+
- 'ghcr.io/traefik/helm-changelog:v{{ .Major }}.{{ .Minor }}-amd64'
54+
- 'ghcr.io/traefik/helm-changelog:v{{ .Major }}.{{ .Minor }}-arm64'
55+
56+
dockers:
57+
- use: buildx
58+
goos: linux
59+
goarch: amd64
60+
dockerfile: buildx.Dockerfile
61+
image_templates:
62+
- 'ghcr.io/traefik/helm-changelog:latest-amd64'
63+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-amd64'
64+
- 'ghcr.io/traefik/helm-changelog:v{{ .Major }}.{{ .Minor }}-amd64'
65+
build_flag_templates:
66+
- '--pull'
67+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
68+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
69+
- '--label=org.opencontainers.image.description=Myrmica Bibikoffi - Closes stale issues'
70+
- '--label=org.opencontainers.image.source={{.GitURL}}'
71+
- '--label=org.opencontainers.image.url={{.GitURL}}'
72+
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
73+
- '--label=org.opencontainers.image.created={{.Date}}'
74+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
75+
- '--label=org.opencontainers.image.version={{.Version}}'
76+
- '--platform=linux/amd64'
77+
78+
- use: buildx
79+
goos: linux
80+
goarch: arm64
81+
dockerfile: buildx.Dockerfile
82+
image_templates:
83+
- 'ghcr.io/traefik/helm-changelog:latest-arm64'
84+
- 'ghcr.io/traefik/helm-changelog:{{ .Tag }}-arm64'
85+
- 'ghcr.io/traefik/helm-changelog:v{{ .Major }}.{{ .Minor }}-arm64'
86+
build_flag_templates:
87+
- '--pull'
88+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
89+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
90+
- '--label=org.opencontainers.image.description=Myrmica Bibikoffi - Closes stale issues'
91+
- '--label=org.opencontainers.image.source={{.GitURL}}'
92+
- '--label=org.opencontainers.image.url={{.GitURL}}'
93+
- '--label=org.opencontainers.image.documentation={{.GitURL}}'
94+
- '--label=org.opencontainers.image.created={{.Date}}'
95+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
96+
- '--label=org.opencontainers.image.version={{.Version}}'
97+
- '--platform=linux/arm64'

0 commit comments

Comments
 (0)