From 0baa26b3f382d4bf1393cf64fbd760686c3cc216 Mon Sep 17 00:00:00 2001 From: Amal Shaji Date: Fri, 24 Feb 2023 13:52:23 +0530 Subject: [PATCH] chore: Update goreleaser config (#28) * Remove server binary build * Publish zip archives for brew * Build and publish docker images for the server --- .github/workflows/release.yml | 8 ++++-- .goreleaser.yaml | 51 ++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fda6cff..8fd0e0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,12 @@ jobs: npm i -g pnpm pnpm install --dir internal/server/web --frozen-lockfile && pnpm run --dir internal/server/web build - # More assembly might be required: Docker logins, GPG, etc. It all depends - # on your needs. + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: amalshaji + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Publish packages uses: goreleaser/goreleaser-action@v4 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ecea731..0f0afac 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -14,24 +14,8 @@ builds: ldflags: - -s -w -X main.build={{.Version}} - - id: "beaver_server" - main: ./cmd/beaver_server - binary: "beaver_server" - env: - - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - ldflags: - - -s -w -X main.build={{.Version}} - archives: - format: binary - # this name template makes the OS and Arch compatible with the results of uname. name_template: >- {{ .Binary }}_ {{- .Version }}_ @@ -40,19 +24,34 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} + + - format: zip + name_template: >- + {{ .Binary }}_ + {{- .Version }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + checksum: name_template: "checksums.txt" + snapshot: name_template: "{{ incpatch .Version }}-next" + changelog: sort: asc filters: exclude: - "^docs:" - "^test:" + release: name_template: "v{{ .Version }}" draft: true + brews: - name: beaver ids: @@ -64,3 +63,23 @@ brews: commit_author: name: Amal Shaji email: amalshajid@gmail.com + +dockers: + - image_templates: + - "amalshaji/beaver:{{ .Version }}-amd64" + use: buildx + dockerfile: deployments/Dockerfile + build_flag_templates: + - "--platform=linux/amd64" + - image_templates: + - "amalshaji/beaver:{{ .Version }}-arm64" + use: buildx + goarch: arm64 + dockerfile: deployments/Dockerfile + build_flag_templates: + - "--platform=linux/arm64" +docker_manifests: + - name_template: "amalshaji/beaver:{{ .Version }}" + image_templates: + - "amalshaji/beaver:{{ .Version }}-amd64" + - "amalshaji/beaver:{{ .Version }}-arm64"