Skip to content

Commit e774f5f

Browse files
authored
feat: add GitHub Actions workflow for snapshot builds and update Docker image references to use ghcr.io (#21)
1 parent da95b2f commit e774f5f

2 files changed

Lines changed: 71 additions & 18 deletions

File tree

.github/workflows/snapshot.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: snapshot
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
goreleaser-snapshot:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '>=1.24'
23+
- name: Install devbox
24+
uses: jetify-com/devbox-install-action@v0.13.0
25+
with:
26+
enable-cache: true
27+
devbox-version: 0.14.0
28+
29+
-
30+
# Add support for more platforms with QEMU (optional)
31+
# https://github.com/docker/setup-qemu-action
32+
name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
-
35+
name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Install prerequisites
46+
shell: /usr/bin/bash {0}
47+
run: |
48+
devbox install
49+
devbox run snapshot
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
53+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.goreleaser.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ dockers:
5454
goos: linux
5555
goarch: amd64
5656
image_templates:
57-
- "sgaunet/{{ .ProjectName }}:{{ .Version }}-amd64"
58-
- "sgaunet/{{ .ProjectName }}:latest-amd64"
57+
- "ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-amd64"
58+
- "ghcr.io/sgaunet/{{ .ProjectName }}:latest-amd64"
5959
build_flag_templates:
6060
- "--platform=linux/amd64"
6161
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -70,8 +70,8 @@ dockers:
7070
goos: linux
7171
goarch: arm64
7272
image_templates:
73-
- "sgaunet/{{ .ProjectName }}:{{ .Version }}-arm64v8"
74-
- "sgaunet/{{ .ProjectName }}:latest-arm64v8"
73+
- "ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-arm64v8"
74+
- "ghcr.io/sgaunet/{{ .ProjectName }}:latest-arm64v8"
7575
build_flag_templates:
7676
- "--platform=linux/arm64/v8"
7777
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -87,8 +87,8 @@ dockers:
8787
goarch: arm
8888
goarm: "6"
8989
image_templates:
90-
- "sgaunet/{{ .ProjectName }}:{{ .Version }}-armv6"
91-
- "sgaunet/{{ .ProjectName }}:latest-armv6"
90+
- "ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-armv6"
91+
- "ghcr.io/sgaunet/{{ .ProjectName }}:latest-armv6"
9292
build_flag_templates:
9393
- "--platform=linux/arm/v6"
9494
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -104,8 +104,8 @@ dockers:
104104
goarch: arm
105105
goarm: "7"
106106
image_templates:
107-
- "sgaunet/{{ .ProjectName }}:{{ .Version }}-armv7"
108-
- "sgaunet/{{ .ProjectName }}:latest-armv7"
107+
- "ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-armv7"
108+
- "ghcr.io/sgaunet/{{ .ProjectName }}:latest-armv7"
109109
build_flag_templates:
110110
- "--platform=linux/arm/v7"
111111
- "--label=org.opencontainers.image.created={{.Date}}"
@@ -118,15 +118,15 @@ dockers:
118118

119119
docker_manifests:
120120
# https://goreleaser.com/customization/docker_manifest/
121-
- name_template: sgaunet/{{ .ProjectName }}:{{ .Version }}
121+
- name_template: ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}
122122
image_templates:
123-
- sgaunet/{{ .ProjectName }}:{{ .Version }}-amd64
124-
- sgaunet/{{ .ProjectName }}:{{ .Version }}-arm64v8
125-
- sgaunet/{{ .ProjectName }}:{{ .Version }}-armv6
126-
- sgaunet/{{ .ProjectName }}:{{ .Version }}-armv7
127-
- name_template: sgaunet/{{ .ProjectName }}:latest
123+
- ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-amd64
124+
- ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-arm64v8
125+
- ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-armv6
126+
- ghcr.io/sgaunet/{{ .ProjectName }}:{{ .Version }}-armv7
127+
- name_template: ghcr.io/sgaunet/{{ .ProjectName }}:latest
128128
image_templates:
129-
- sgaunet/{{ .ProjectName }}:latest-amd64
130-
- sgaunet/{{ .ProjectName }}:latest-arm64v8
131-
- sgaunet/{{ .ProjectName }}:latest-armv6
132-
- sgaunet/{{ .ProjectName }}:latest-armv7
129+
- ghcr.io/sgaunet/{{ .ProjectName }}:latest-amd64
130+
- ghcr.io/sgaunet/{{ .ProjectName }}:latest-arm64v8
131+
- ghcr.io/sgaunet/{{ .ProjectName }}:latest-armv6
132+
- ghcr.io/sgaunet/{{ .ProjectName }}:latest-armv7

0 commit comments

Comments
 (0)