From 0949422aa3b2b9fb70680a4666865de47bebcd5b Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:03:19 -0800 Subject: [PATCH] wip: goreleaser --- .github/workflows/pull-requests.yaml | 15 ++++ .gitignore | 3 +- backend/.goreleaser.yaml | 111 +++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 backend/.goreleaser.yaml diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 2debdbd..eb9ecf4 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -13,3 +13,18 @@ jobs: frontend-tests: name: "Frontend and End-to-End Tests" uses: ./.github/workflows/partial-frontend.yaml + + releaser: + name: "Cross Compile and Release" + runs-on: ubuntu-latest + container: + image: goreleaser/goreleaser:v1.20 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "Cross Compile and Release" + run: goreleaser releaser --snapshot --clean --skip-publish diff --git a/.gitignore b/.gitignore index 05e4ebd..bdda034 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ dist .pnpm-store backend/app/api/app -backend/app/api/__debug_bin \ No newline at end of file +backend/app/api/__debug_bin +dist/ diff --git a/backend/.goreleaser.yaml b/backend/.goreleaser.yaml new file mode 100644 index 0000000..eb2171c --- /dev/null +++ b/backend/.goreleaser.yaml @@ -0,0 +1,111 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +env: + - CGO_ENABLED=1 +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - id: homebox-darwin-amd64 + binary: homebox + main: ./app/api/main.go + goarch: + - amd64 + goos: + - darwin + env: + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -trimpath + + - id: homebox-darwin-arm64 + binary: homebox + main: ./app/api/main.go + goarch: + - arm64 + goos: + - darwin + env: + - CC=oa64-clang + - CXX=oa64-clang++ + flags: + - -trimpath + + - id: homebox-linux-amd64 + binary: homebox + main: ./app/api/main.go + env: + - CC=x86_64-linux-gnu-gcc + - CXX=x86_64-linux-gnu-g++ + goarch: + - amd64 + goos: + - linux + flags: + - -trimpath + ldflags: + - -extldflags "-lc -lrt -lpthread --static" + + - id: homebox-linux-arm64 + binary: homebox + main: ./app/api/main.go + goarch: + - arm64 + goos: + - linux + env: + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ + flags: + - -trimpath + ldflags: + - -extldflags "-lc -lrt -lpthread --static" + + - id: homebox-windows-amd64 + binary: homebox + main: ./app/api/main.go + goarch: + - amd64 + goos: + - windows + env: + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + flags: + - -trimpath + - -buildmode=exe + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of uname. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj