Skip to content

Commit

Permalink
build: release images and build snapshots by default
Browse files Browse the repository at this point in the history
  • Loading branch information
fntlnz committed Jul 29, 2024
1 parent 5f9b3e3 commit b8c020f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches:
- master
tags:
- "v*.*.*"
# tags:
# - "v*.*.*"
jobs:
buildx:
runs-on: ubuntu-latest
Expand All @@ -23,26 +23,5 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
public.cr.seqera.io/seqeralabs/staticreg
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build image and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm64,linux/amd64
build-args: "GO_IMAGE=docker.io/golang:1.22"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build snapshot
run: make snapshot
22 changes: 22 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,36 @@ version: 2

dist: _output/dist

# build binaries
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
# build container images
dockers:
- image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-amd64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-arm64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
goarch: arm64

# merge multi arch image manifests
docker_manifests:
- name_template: "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}"
image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-amd64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-arm64"
archives:
- format: tar.gz
name_template: >-
Expand Down
11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
ARG GO_IMAGE=docker.io/golang:1.22
FROM ${GO_IMAGE} AS builder
ADD . /project
WORKDIR /project

RUN make DEBUG=0

FROM scratch

COPY --from=builder /project/_output/bin/staticreg /staticreg
COPY staticreg /

ENTRYPOINT ["/staticreg"]
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ _output/deps/tailwindcss: _output/deps
echo "$(TAILWINDCSS_SHA256SUM) $@" | $(SHA256SUM_CMD) --check
chmod +x $@


tools:
.PHONY: deps
deps:
Expand All @@ -54,3 +53,7 @@ release:
git tag -a "v$(VERSION)" -m "v$(VERSION)"
git push origin v$(VERSION)
$(GORELEASER_CMD) release --clean --fail-fast

.PHONY: snapshot
snapshot:
$(GORELEASER_CMD) release --snapshot --clean

0 comments on commit b8c020f

Please sign in to comment.