Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

feat: try different split build (no GoReleaser Pro)

Matthew Kilgorec2dd6f61bcaf
diff --git a/.github/workflows/binaries-publish.yaml b/.github/workflows/binaries-publish.yaml
index 44b598f2..6c8b5f81 100644
--- a/.github/workflows/binaries-publish.yaml
+++ b/.github/workflows/binaries-publish.yaml
@@ -59,10 +59,6 @@ jobs:
name: frontend-static
path: backend/app/api/static/
- - name: Install CoSign
- working-directory: backend
- run: |
- go install github.com/sigstore/cosign/cmd/cosign@latest
- name: Install Syft
working-directory: backend
@@ -76,12 +72,9 @@ jobs:
workdir: "backend"
distribution: goreleaser
version: "~> v2"
- args: release --clean --split ${{ !startsWith(github.ref, 'refs/tags/') && '--snapshot' || '' }}
+ args: release --clean --skip=publish --config .goreleaser.${{ matrix.goarch }}.yaml ${{ !startsWith(github.ref, 'refs/tags/') && '--snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
- COSIGN_YES: "true"
- GOARCH: ${{ matrix.goarch }}
- name: Upload GoReleaser Artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -90,7 +83,6 @@ jobs:
path: backend/dist
retention-days: 1
-
goreleaser-merge:
name: Merge and Publish Release
runs-on: ubuntu-latest
@@ -107,52 +99,50 @@ jobs:
with:
fetch-depth: 0
- - name: Set up Go
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c
- with:
- go-version: "1.25"
- cache-dependency-path: backend/go.mod
-
- name: Download All GoReleaser Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
- path: backend/dist
+ path: dist
pattern: goreleaser-*
merge-multiple: true
- - name: Install CoSign
- working-directory: backend
- run: |
- go install github.com/sigstore/cosign/cmd/cosign@latest
+ - name: Set up Go
+ uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c
+ with:
+ go-version: "1.25"
- - name: Install Syft
- working-directory: backend
+ - name: Combine checksums
+ working-directory: dist
run: |
- go install github.com/anchore/syft/cmd/syft@latest
+ # Combine all architecture-specific checksums into one file
+ cat checksums-*.txt | sort > checksums.txt
+ rm checksums-*.txt
- - name: Run GoReleaser Continue
- id: releaser
- uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a
- with:
- workdir: "backend"
- distribution: goreleaser
- version: "~> v2"
- args: continue --merge ${{ !startsWith(github.ref, 'refs/tags/') && '--skip=publish' || '' }}
+ - name: Upload to GitHub Release
+ if: startsWith(github.ref, 'refs/tags/')
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
- COSIGN_YES: "true"
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ # Create release if it doesn't exist
+ gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file CHANGELOG.md --draft=false || true
+
+ # Upload all archives
+ gh release upload "$GITHUB_REF_NAME" dist/*.tar.gz --clobber || true
+ gh release upload "$GITHUB_REF_NAME" dist/*.zip --clobber || true
+
+ # Upload checksums
+ gh release upload "$GITHUB_REF_NAME" dist/checksums.txt --clobber
+
+ # Upload SBOMs
+ gh release upload "$GITHUB_REF_NAME" dist/*.sbom.json --clobber || true
- name: Generate binary hashes
id: binary
if: startsWith(github.ref, 'refs/tags/')
- env:
- ARTIFACTS: "${{ steps.releaser.outputs.artifacts }}"
run: |
set -euo pipefail
-
- checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path')
- echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT"
+ # The checksums.txt already contains hashes for all binary archives
+ echo "hashes=$(cat dist/checksums.txt | base64 -w0)" >> "$GITHUB_OUTPUT"
binary-provenance:
if: startsWith(github.ref, 'refs/tags/')
@@ -184,6 +174,7 @@ jobs:
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.tar.gz"
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.zip"
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "$PROVENANCE"
+
- name: Verify assets
env:
CHECKSUMS: ${{ needs.goreleaser-merge.outputs.hashes }}
diff --git a/backend/.goreleaser.amd64.yaml b/backend/.goreleaser.amd64.yaml
new file mode 100644
index 00000000..69901478
--- /dev/null
+++ b/backend/.goreleaser.amd64.yaml
@@ -0,0 +1,50 @@
+version: 2
+
+# Architecture-specific config for amd64
+# Make sure to check the documentation at https://goreleaser.com
+before:
+ hooks:
+ - go generate ./...
+builds:
+ - main: ./app/api
+ env:
+ - CGO_ENABLED=0
+ goos:
+ - linux
+ - windows
+ - darwin
+ - freebsd
+ goarch:
+ - amd64
+ flags:
+ - -trimpath
+ ldflags:
+ - -s -w
+ - -X main.version={{.Version}}
+ - -X main.commit={{.Commit}}
+ - -X main.date={{.Date}}
+
+archives:
+ - formats: [ 'tar.gz' ]
+ name_template: >-
+ {{ .ProjectName }}_
+ {{- title .Os }}_
+ {{- if eq .Arch "amd64" }}x86_64
+ {{- else }}{{ .Arch }}{{ end }}
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
+ format_overrides:
+ - goos: windows
+ formats: [ 'zip' ]
+sboms:
+ - artifacts: archive
+checksum:
+ name_template: 'checksums-amd64.txt'
+snapshot:
+ version_template: "{{ incpatch .Version }}-next"
+changelog:
+ disable: true
+release:
+ disable: true
+
+# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
+# vim: set ts=2 sw=2 tw=0 fo=cnqoj
diff --git a/backend/.goreleaser.arm64.yaml b/backend/.goreleaser.arm64.yaml
new file mode 100644
index 00000000..09625025
--- /dev/null
+++ b/backend/.goreleaser.arm64.yaml
@@ -0,0 +1,50 @@
+version: 2
+
+# Architecture-specific config for arm64
+# Make sure to check the documentation at https://goreleaser.com
+before:
+ hooks:
+ - go generate ./...
+builds:
+ - main: ./app/api
+ env:
+ - CGO_ENABLED=0
+ goos:
+ - linux
+ - windows
+ - darwin
+ - freebsd
+ goarch:
+ - arm64
+ flags:
+ - -trimpath
+ ldflags:
+ - -s -w
+ - -X main.version={{.Version}}
+ - -X main.commit={{.Commit}}
+ - -X main.date={{.Date}}
+
+archives:
+ - formats: [ 'tar.gz' ]
+ name_template: >-
+ {{ .ProjectName }}_
+ {{- title .Os }}_
+ {{- if eq .Arch "amd64" }}x86_64
+ {{- else }}{{ .Arch }}{{ end }}
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
+ format_overrides:
+ - goos: windows
+ formats: [ 'zip' ]
+sboms:
+ - artifacts: archive
+checksum:
+ name_template: 'checksums-arm64.txt'
+snapshot:
+ version_template: "{{ incpatch .Version }}-next"
+changelog:
+ disable: true
+release:
+ disable: true
+
+# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
+# vim: set ts=2 sw=2 tw=0 fo=cnqoj
diff --git a/backend/.goreleaser.riscv64.yaml b/backend/.goreleaser.riscv64.yaml
new file mode 100644
index 00000000..9be92846
--- /dev/null
+++ b/backend/.goreleaser.riscv64.yaml
@@ -0,0 +1,47 @@
+version: 2
+
+# Architecture-specific config for riscv64
+# Make sure to check the documentation at https://goreleaser.com
+before:
+ hooks:
+ - go generate ./...
+builds:
+ - main: ./app/api
+ env:
+ - CGO_ENABLED=0
+ goos:
+ - linux
+ - freebsd
+ goarch:
+ - riscv64
+ flags:
+ - -trimpath
+ ldflags:
+ - -s -w
+ - -X main.version={{.Version}}
+ - -X main.commit={{.Commit}}
+ - -X main.date={{.Date}}
+ tags:
+ - nodynamic
+
+archives:
+ - formats: [ 'tar.gz' ]
+ name_template: >-
+ {{ .ProjectName }}_
+ {{- title .Os }}_
+ {{- if eq .Arch "amd64" }}x86_64
+ {{- else }}{{ .Arch }}{{ end }}
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
+sboms:
+ - artifacts: archive
+checksum:
+ name_template: 'checksums-riscv64.txt'
+snapshot:
+ version_template: "{{ incpatch .Version }}-next"
+changelog:
+ disable: true
+release:
+ disable: true
+
+# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
+# vim: set ts=2 sw=2 tw=0 fo=cnqoj
diff --git a/backend/.goreleaser.yaml b/backend/.goreleaser.yaml
index 1a25fc51..7b0800c7 100644
--- a/backend/.goreleaser.yaml
+++ b/backend/.goreleaser.yaml
@@ -32,16 +32,6 @@ builds:
{{- else if eq .Os "freebsd" }}nodynamic
{{ end }}
-signs:
- - cmd: cosign
- signature: "${artifact}.sigstore.json"
- args:
- - sign-blob
- - "--bundle=${signature}"
- - "${artifact}"
- - "--yes"
- artifacts: checksum
- output: true
archives:
- formats: [ 'tar.gz' ]
# this name template makes the OS and Arch compatible with the results of uname.
@@ -57,9 +47,6 @@ archives:
formats: [ 'zip' ]
sboms:
- artifacts: archive
-release:
- extra_files:
- - glob: dist/*.sig
checksum:
name_template: 'checksums.txt'
snapshot: