Skip to content

Commit 1c076dc

Browse files
add separate goreleaser config for rebuilding the docker image only (#309)
* add separate goreleaser config for rebuilding the docker image
1 parent 952380f commit 1c076dc

File tree

4 files changed

+126
-1
lines changed

4 files changed

+126
-1
lines changed

.github/workflows/docker.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Rebuild docker image
2+
3+
on:
4+
schedule:
5+
- cron: '32 6 * * 0'
6+
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
fetch-tags: true
17+
18+
- name: Checkout latest tag
19+
run: |
20+
export LATEST_TAG=`git describe --tags --abbrev=0`
21+
git checkout $LATEST_TAG
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: ~1.21
27+
check-latest: true
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
32+
- name: Login to DockerHub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
38+
- name: Install eget
39+
run: go install github.com/zyedidia/eget@latest
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Run GoReleaser
44+
uses: goreleaser/goreleaser-action@v5
45+
with:
46+
version: latest
47+
args: release --clean --debug --config .goreleaser-docker-only.yml
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: actions/setup-go@v5
2121
with:
2222
go-version: ~1.21
23+
check-latest: true
2324

2425
- name: Set up QEMU
2526
uses: docker/setup-qemu-action@v3

.goreleaser-docker-only.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
project_name: resticprofile
2+
3+
before:
4+
hooks:
5+
- go mod download
6+
- go generate ./...
7+
- eget rclone/rclone --upgrade-only --system=linux/amd64 --to=build/rclone-amd64 --asset=zip
8+
- eget rclone/rclone --upgrade-only --system=linux/arm64 --to=build/rclone-arm64 --asset=zip
9+
- eget restic/restic --upgrade-only --system=linux/amd64 --to=build/restic-amd64
10+
- eget restic/restic --upgrade-only --system=linux/arm64 --to=build/restic-arm64
11+
12+
builds:
13+
- id: resticprofile_targz
14+
env:
15+
- CGO_ENABLED=0
16+
goos:
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm64
21+
22+
archives:
23+
- id: targz
24+
builds:
25+
- resticprofile_targz
26+
format: tar.gz
27+
28+
dockers:
29+
- image_templates:
30+
- "creativeprojects/resticprofile:latest-amd64"
31+
- "creativeprojects/resticprofile:{{ .RawVersion }}-amd64"
32+
ids:
33+
- resticprofile_targz
34+
use: buildx
35+
goos: linux
36+
goarch: amd64
37+
dockerfile: build/Dockerfile
38+
extra_files:
39+
- build/restic-amd64
40+
- build/rclone-amd64
41+
build_flag_templates:
42+
- "--platform=linux/amd64"
43+
- "--build-arg=ARCH=amd64"
44+
skip_push: true # remove after Sunday
45+
- image_templates:
46+
- "creativeprojects/resticprofile:latest-arm64v8"
47+
- "creativeprojects/resticprofile:{{ .RawVersion }}-arm64v8"
48+
ids:
49+
- resticprofile_targz
50+
use: buildx
51+
goos: linux
52+
goarch: arm64
53+
dockerfile: build/Dockerfile
54+
extra_files:
55+
- build/restic-arm64
56+
- build/rclone-arm64
57+
build_flag_templates:
58+
- "--platform=linux/arm64/v8"
59+
- "--build-arg=ARCH=arm64"
60+
skip_push: true # remove after Sunday
61+
62+
docker_manifests:
63+
- name_template: creativeprojects/resticprofile:{{ .RawVersion }}
64+
image_templates:
65+
- creativeprojects/resticprofile:{{ .RawVersion }}-amd64
66+
- creativeprojects/resticprofile:{{ .RawVersion }}-arm64v8
67+
skip_push: true # remove after Sunday
68+
- name_template: creativeprojects/resticprofile:latest
69+
image_templates:
70+
- creativeprojects/resticprofile:latest-amd64
71+
- creativeprojects/resticprofile:latest-arm64v8
72+
skip_push: true # remove after Sunday
73+
74+
release:
75+
disable: true

.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ archives:
9898
builds:
9999
- resticprofile_zip
100100
format: zip
101-
101+
102102
checksum:
103103
name_template: 'checksums.txt'
104104

0 commit comments

Comments
 (0)