Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: support linux/arm64 & release cross-platform binary (#987)

qsliuc611f590b898
diff --git a/.github/workflows/build-release-image.yml b/.github/workflows/build-release-image.yml
index d4f6d8b8dc..9f87083047 100644
--- a/.github/workflows/build-release-image.yml
+++ b/.github/workflows/build-release-image.yml
@@ -53,3 +53,31 @@ jobs:
BUILD_USER=${{ env.BUILD_USER }}
- name: Image digest
run: echo "Successfully pushed bytebase/bb:${{ env.BB_VERSION }} ${{ steps.bb_build.outputs.digest }}"
+
+ release-binary:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: pnpm/[email protected]
+ with:
+ version: 6.10.0
+ - uses: actions/setup-node@v3
+ with:
+ node-version: "14"
+ cache: "pnpm"
+ cache-dependency-path: "frontend/pnpm-lock.yaml"
+ - run: pnpm install --frozen-lockfile
+ working-directory: frontend
+ - run: pnpm release
+ working-directory: frontend
+ - name: Extract version
+ run: git tag ${GITHUB_REF_NAME#release/v}
+ - uses: actions/setup-go@v2
+ with:
+ go-version: 1.16
+ - name: "Release"
+ uses: goreleaser/goreleaser-action@v2
+ with:
+ args: release
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 64c0d83804..9acfcbeb00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,5 @@ bytebase-build
.idea
.DS_Store
+
+dist/
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
new file mode 100644
index 0000000000..bc023a2648
--- /dev/null
+++ b/.goreleaser.yaml
@@ -0,0 +1,67 @@
+before:
+ hooks:
+ - go mod tidy
+builds:
+ - id: server
+ main: ./bin/server
+ binary: bytebase
+ ldflags:
+ - -w -s
+ - -X github.com/bytebase/bytebase/bin/server/cmd.version={{.Version}}
+ - -X github.com/bytebase/bytebase/bin/server/cmd.goversion=${GO_VERSION}
+ - -X github.com/bytebase/bytebase/bin/server/cmd.gitcommit={{.Commit}}
+ - -X github.com/bytebase/bytebase/bin/server/cmd.buildtime={{.Timestamp}}
+ - -X github.com/bytebase/bytebase/bin/server/cmd.builduser=goreleaser
+ tags:
+ - release
+ env:
+ - VERSION="development"
+ - GO_VERSION="1.16.5"
+ - GIT_COMMIT="unknown"
+ - BUILD_TIME="unknown"
+ - BUILD_USER="unknown"
+ goos:
+ - linux
+ - darwin
+ goarch:
+ - amd64
+ - arm64
+ - id: cli
+ main: ./bin/bb
+ binary: bb
+ ldflags:
+ - -w -s
+ - -X github.com/bytebase/bytebase/bin/bb/cmd.version={{.Version}}
+ - -X github.com/bytebase/bytebase/bin/bb/cmd.goversion=${GO_VERSION}
+ - -X github.com/bytebase/bytebase/bin/bb/cmd.gitcommit={{.Commit}}
+ - -X github.com/bytebase/bytebase/bin/bb/cmd.buildtime={{.Timestamp}}
+ - -X github.com/bytebase/bytebase/bin/bb/cmd.builduser=goreleaser
+ tags:
+ - release
+ env:
+ - VERSION="development"
+ - GO_VERSION="1.16.5"
+ - GIT_COMMIT="unknown"
+ - BUILD_TIME="unknown"
+ - BUILD_USER="unknown"
+ goos:
+ - linux
+ - darwin
+ goarch:
+ - amd64
+ - arm64
+archives:
+ - replacements:
+ darwin: Darwin
+ linux: Linux
+ amd64: x86_64
+checksum:
+ name_template: "checksums.txt"
+snapshot:
+ name_template: "{{ incpatch .Version }}-next"
+changelog:
+ sort: asc
+ filters:
+ exclude:
+ - "^docs:"
+ - "^test:"
diff --git a/resources/README.md b/resources/README.md
index 1ab62229a6..d7dd8ac8e9 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -8,6 +8,8 @@ We will embed Postgres binaries to serve and store backend data. We will extract
linux/amd64 used for Linux (MD5 3b5b460450f09543f1055e7ffd1cf773): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64/14.2.0/embedded-postgres-binaries-linux-amd64-14.2.0.jar
+linux/arm64 used for Linux arm64 (MD5 db2d840c9a35d9cfb661a0fd9a690829): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-arm64v8/14.2.0/embedded-postgres-binaries-linux-arm64v8-14.2.0.jar
+
linux/amd64 used for Alpine Linux - Docker image (MD5 2f7e10b17683bcbcba264057d7c4215d): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-linux-amd64-alpine/14.2.0/embedded-postgres-binaries-linux-amd64-alpine-14.2.0.jar
darwin/amd64 used for MacOS development (MD5 d95d5c5fccc1e1ef45de6533fd8e6d0a): https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-amd64/14.2.0/embedded-postgres-binaries-darwin-amd64-14.2.0.jar
diff --git a/resources/postgres/resources_linux.go b/resources/postgres/resources_linux_amd64.go
similarity index 100%
rename from resources/postgres/resources_linux.go
rename to resources/postgres/resources_linux_amd64.go
diff --git a/resources/postgres/resources_linux_arm64.go b/resources/postgres/resources_linux_arm64.go
new file mode 100644
index 0000000000..e5a0252386
--- /dev/null
+++ b/resources/postgres/resources_linux_arm64.go
@@ -0,0 +1,9 @@
+//go:build !alpine
+// +build !alpine
+
+package postgres
+
+import "embed"
+
+//go:embed postgres-linux-arm_64.txz
+var resources embed.FS