From 543c9a3e50dbca6f5a6d014c8e056783be7a906b Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:28:05 +0000 Subject: [PATCH 01/13] feat: leverage go build feature to enable multiple binaries --- release.sh | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/release.sh b/release.sh index e90b322..ca6e76a 100755 --- a/release.sh +++ b/release.sh @@ -95,20 +95,34 @@ else fi fi +# leverage golang feature to support multiple binaries +# for example, 'go build -o xxx ./cmd/...' to generate multiple binaries' +if [[ "${INPUT_PROJECT_PATH}" =~ ^\./.*/\.\.\. ]]; then + MULTIPLE_BINARIES=TRUE +else + MULTIPLE_BINARIES= +fi + # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) -RELEASE_ASSET_DIR=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER} -mkdir -p ${RELEASE_ASSET_DIR} -cd ${INPUT_PROJECT_PATH} -if [[ "${INPUT_BUILD_COMMAND}" =~ ^make.* ]]; then - # start with make, assumes using make to build golang binaries, execute it directly - GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} eval ${INPUT_BUILD_COMMAND} - if [ -f "${BINARY_NAME}${EXT}" ]; then - # assumes the binary will be generated in current dir, copy it for later processes - cp ${BINARY_NAME}${EXT} ${BUILD_ARTIFACTS_FOLDER}/ - fi +if [ ! -z ${MULTIPLE_BINARIES} ]; then + RELEASE_ASSET_DIR=${BUILD_ARTIFACTS_FOLDER} + mkdir -p ${RELEASE_ASSET_DIR} + GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} -o ${BUILD_ARTIFACTS_FOLDER} ${INPUT_PROJECT_PATH} ${INPUT_BUILD_FLAGS} ${LDFLAGS_PREFIX} "${INPUT_LDFLAGS}" else - GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} -o ${BUILD_ARTIFACTS_FOLDER}/${BINARY_NAME}${EXT} ${INPUT_BUILD_FLAGS} ${LDFLAGS_PREFIX} "${INPUT_LDFLAGS}" + RELEASE_ASSET_DIR=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER} + mkdir -p ${RELEASE_ASSET_DIR} + cd ${INPUT_PROJECT_PATH} + if [[ "${INPUT_BUILD_COMMAND}" =~ ^make.* ]]; then + # start with make, assumes using make to build golang binaries, execute it directly + GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} eval ${INPUT_BUILD_COMMAND} + if [ -f "${BINARY_NAME}${EXT}" ]; then + # assumes the binary will be generated in current dir, copy it for later processes + cp ${BINARY_NAME}${EXT} ${BUILD_ARTIFACTS_FOLDER}/ + fi + else + GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} -o ${BUILD_ARTIFACTS_FOLDER}/${BINARY_NAME}${EXT} ${INPUT_BUILD_FLAGS} ${LDFLAGS_PREFIX} "${INPUT_LDFLAGS}" + fi fi # executable compression @@ -126,7 +140,9 @@ fi if [ ! -z "${INPUT_EXTRA_FILES}" ]; then cd ${GITHUB_WORKSPACE} cp -r ${INPUT_EXTRA_FILES} ${RELEASE_ASSET_DIR}/ - cd ${INPUT_PROJECT_PATH} + if [ -z ${MULTIPLE_BINARIES} ]; then + cd ${INPUT_PROJECT_PATH} + fi fi cd ${BUILD_ARTIFACTS_FOLDER} From 7382ad935a95c90464b30a754b5016f669f9bc9b Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Mon, 2 Jan 2023 08:06:14 +0000 Subject: [PATCH 02/13] chore: add multi-binaries test --- .github/workflows/autotest.yml | 22 ++++++++++++++++++++++ test/.gitignore | 2 ++ test/mutli-binaries/cmd1/test_main.go | 26 ++++++++++++++++++++++++++ test/mutli-binaries/cmd2/test_main.go | 26 ++++++++++++++++++++++++++ test/mutli-binaries/go.mod | 3 +++ test/test_main.go | 7 +++++-- 6 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 test/mutli-binaries/cmd1/test_main.go create mode 100644 test/mutli-binaries/cmd2/test_main.go create mode 100644 test/mutli-binaries/go.mod diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index b0ca354..ff49a40 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -199,3 +199,25 @@ jobs: overwrite: true release_tag: v0.1-test-assets compress_assets: ${{ matrix.compress_assets }} + + multi-binaries-test: + name: Multi Binaries Test + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, windows, darwin] + goarch: [amd64] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run go-release-action on test code + uses: ./ + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + project_path: ./test/mutli-binaries/... + extra_files: LICENSE README.md + build_flags: -v + overwrite: true + release_tag: v0.1-test-assets diff --git a/test/.gitignore b/test/.gitignore index db8c13c..a55975c 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,3 +1,5 @@ go.mod go.sum testmain +cmd1 +cmd2 \ No newline at end of file diff --git a/test/mutli-binaries/cmd1/test_main.go b/test/mutli-binaries/cmd1/test_main.go new file mode 100644 index 0000000..4b0857d --- /dev/null +++ b/test/mutli-binaries/cmd1/test_main.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "os" +) + +const notSet string = "not set" + +// these information will be collected when build, by `-ldflags "-X main.gitCommit=06b8d24"` +var ( + buildTime = notSet + gitCommit = notSet + gitRef = notSet +) + +func printVersion() { + fmt.Printf("Build Time: %s\n", buildTime) + fmt.Printf("Git Commit: %s\n", gitCommit) + fmt.Printf("Git Ref: %s\n", gitRef) +} + +func main() { + fmt.Printf("%s Hello Action!\n", os.Args[0]) + printVersion() +} diff --git a/test/mutli-binaries/cmd2/test_main.go b/test/mutli-binaries/cmd2/test_main.go new file mode 100644 index 0000000..4b0857d --- /dev/null +++ b/test/mutli-binaries/cmd2/test_main.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "os" +) + +const notSet string = "not set" + +// these information will be collected when build, by `-ldflags "-X main.gitCommit=06b8d24"` +var ( + buildTime = notSet + gitCommit = notSet + gitRef = notSet +) + +func printVersion() { + fmt.Printf("Build Time: %s\n", buildTime) + fmt.Printf("Git Commit: %s\n", gitCommit) + fmt.Printf("Git Ref: %s\n", gitRef) +} + +func main() { + fmt.Printf("%s Hello Action!\n", os.Args[0]) + printVersion() +} diff --git a/test/mutli-binaries/go.mod b/test/mutli-binaries/go.mod new file mode 100644 index 0000000..b5834ea --- /dev/null +++ b/test/mutli-binaries/go.mod @@ -0,0 +1,3 @@ +module localtest-multi-binaries + +go 1.19 diff --git a/test/test_main.go b/test/test_main.go index 6ba8729..4b0857d 100644 --- a/test/test_main.go +++ b/test/test_main.go @@ -1,6 +1,9 @@ package main -import "fmt" +import ( + "fmt" + "os" +) const notSet string = "not set" @@ -18,6 +21,6 @@ func printVersion() { } func main() { - fmt.Println("Hello Action!") + fmt.Printf("%s Hello Action!\n", os.Args[0]) printVersion() } From 449214ec42740cf9dc9c4805e4d4a8c977f4336b Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:37:28 +0000 Subject: [PATCH 03/13] doc: multiple binaries support --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 38e45f4..ec1fd26 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Automatically publish `Go` binaries to Github Release Assets through Github Acti - Support private repositories. - Support executable compression by [upx](https://github.com/upx/upx). - Support retry if upload phase fails. +- Support build multiple binaries and include them in one package(`.zip/.tar.gz`). ## Usage @@ -62,7 +63,7 @@ jobs: | goamd64 | **Optional** | `GOAMD64` is the running programs amd64 microarchitecture level, which is available since `go1.18`. It should only be used when `GOARCH` is `amd64`: one of `v1`, `v2`, `v3`, `v4`. | | goarm | **Optional** | `GOARM` is the running programs arm microarchitecture level, which is available since `go1.1`. It should only be used when `GOARCH` is `arm`: one of `5`, `6`, `7`, | | goversion | **Optional** | The `Go` compiler version. `latest`([check it here](https://go.dev/VERSION?m=text)) by default, optional `1.13`, `1.14`, `1.15`, `1.16`, `1.17`, `1.18`, `1.19`. You can also define a specific minor release, such as `1.19.5`.
Alternatively takes a download URL or a path to go.mod instead of version string. Make sure your URL references the `linux-amd64` package. You can find the URL on [Go - Downloads](https://go.dev/dl/).
e.g., `https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz`. | -| project_path | **Optional** | Where to run `go build`.
Use `.` by default. | +| project_path | **Optional** | Where to run `go build`.
Use `.` by default.
Assume you have multiple binaries in your `repo/cmd`, you can use `project_path: ./cmd/...` to build multiple binaries and include them in one package. | | binary_name | **Optional** | Specify another binary name if do not want to use repository basename.
Use your repository's basename if not set. | | pre_command | **Optional** | Extra command that will be executed before `go build`. You may want to use it to solve dependency if you're NOT using [Go Modules](https://github.com/golang/go/wiki/Modules). | | build_command | **Optional** | The actual command to build binary, typically `go build`. You may want to use other command wrapper, e.g., [packr2](https://github.com/gobuffalo/packr/tree/master/v2), example `build_command: 'packr2 build'`. Remember to use `pre_command` to set up `packr2` command in this scenario.
It also supports the `make`(`Makefile`) building system, example `build_command: make`. In this case both `build_flags` and `ldflags` will be ignored since they should be written in your `Makefile` already. Also, please make sure the generated binary placed in the path where `make` runs, i.e., `project_path`. | From 9f203b3cc36f55b51b0ed6dbb3b4a38a9719ad77 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:41:24 +0000 Subject: [PATCH 04/13] chore: enhance test --- .github/workflows/autotest.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index ff49a40..e1f72db 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -208,6 +208,8 @@ jobs: goos: [linux, windows, darwin] goarch: [amd64] steps: + - name: Set BUILD_TIME env + run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV} - name: Checkout uses: actions/checkout@v4 - name: Run go-release-action on test code @@ -218,6 +220,6 @@ jobs: goarch: ${{ matrix.goarch }} project_path: ./test/mutli-binaries/... extra_files: LICENSE README.md - build_flags: -v + build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }} overwrite: true release_tag: v0.1-test-assets From cf93ea7e6cd0ce7ef13b761ef81473039d4ec304 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:49:44 +0000 Subject: [PATCH 05/13] fix: multi test --- .github/workflows/autotest.yml | 3 ++- test/mutli-binaries/go.mod | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 test/mutli-binaries/go.mod diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index e1f72db..5516f8b 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -218,7 +218,8 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} - project_path: ./test/mutli-binaries/... + project_path: ./mutli-binaries/... + pre_command: go mod init localtest extra_files: LICENSE README.md build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }} overwrite: true diff --git a/test/mutli-binaries/go.mod b/test/mutli-binaries/go.mod deleted file mode 100644 index b5834ea..0000000 --- a/test/mutli-binaries/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module localtest-multi-binaries - -go 1.19 From ff0ab4081bcfea2afeeeca1997206654c4e11b54 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:53:31 +0000 Subject: [PATCH 06/13] fix: syntax --- .github/workflows/autotest.yml | 2 +- test/{mutli-binaries => multi-binaries}/cmd1/test_main.go | 0 test/{mutli-binaries => multi-binaries}/cmd2/test_main.go | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename test/{mutli-binaries => multi-binaries}/cmd1/test_main.go (100%) rename test/{mutli-binaries => multi-binaries}/cmd2/test_main.go (100%) diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index 5516f8b..13596f4 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -218,7 +218,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} - project_path: ./mutli-binaries/... + project_path: ./test/multi-binaries/... pre_command: go mod init localtest extra_files: LICENSE README.md build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }} diff --git a/test/mutli-binaries/cmd1/test_main.go b/test/multi-binaries/cmd1/test_main.go similarity index 100% rename from test/mutli-binaries/cmd1/test_main.go rename to test/multi-binaries/cmd1/test_main.go diff --git a/test/mutli-binaries/cmd2/test_main.go b/test/multi-binaries/cmd2/test_main.go similarity index 100% rename from test/mutli-binaries/cmd2/test_main.go rename to test/multi-binaries/cmd2/test_main.go From 4f71b55f6bc050189c68deb22bbaf42d64871bd4 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 14:56:48 +0000 Subject: [PATCH 07/13] fix: tag --- .github/workflows/autotest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index 13596f4..c8990b4 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -209,7 +209,7 @@ jobs: goarch: [amd64] steps: - name: Set BUILD_TIME env - run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV} + run: echo BUILD_TIME=$(date -u +%Y%m%dT%H%M%S) >> ${GITHUB_ENV} - name: Checkout uses: actions/checkout@v4 - name: Run go-release-action on test code From f7af8a0bf6bf5274f3747fb74ab7873a7cd858f4 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 7 Feb 2024 15:02:49 +0000 Subject: [PATCH 08/13] fix: build error --- release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.sh b/release.sh index ca6e76a..28d8e23 100755 --- a/release.sh +++ b/release.sh @@ -108,7 +108,7 @@ BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) if [ ! -z ${MULTIPLE_BINARIES} ]; then RELEASE_ASSET_DIR=${BUILD_ARTIFACTS_FOLDER} mkdir -p ${RELEASE_ASSET_DIR} - GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} -o ${BUILD_ARTIFACTS_FOLDER} ${INPUT_PROJECT_PATH} ${INPUT_BUILD_FLAGS} ${LDFLAGS_PREFIX} "${INPUT_LDFLAGS}" + GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} ${INPUT_BUILD_FLAGS} -o ${BUILD_ARTIFACTS_FOLDER} ${INPUT_PROJECT_PATH} else RELEASE_ASSET_DIR=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER} mkdir -p ${RELEASE_ASSET_DIR} From d01314e66289a8e3cba2db5da1ab9c0dbedb08b5 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sat, 24 Feb 2024 02:48:06 +0000 Subject: [PATCH 09/13] feat: add multi_binaries arg --- action.yml | 6 ++++++ release.sh | 14 +++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index f5adf41..16e3b38 100644 --- a/action.yml +++ b/action.yml @@ -103,6 +103,10 @@ inputs: description: 'Upload release assets or not' required: false default: 'TRUE' + multi_binaries: + description: 'Build and package multiple binaries together' + required: false + default: 'FALSE' outputs: release_asset_dir: @@ -136,6 +140,8 @@ runs: - ${{ inputs.retry }} - ${{ inputs.post_command }} - ${{ inputs.compress_assets }} + - ${{ inputs.upload }} + - ${{ inputs.multi_binaries }} branding: icon: 'package' diff --git a/release.sh b/release.sh index 28d8e23..e21bcc7 100755 --- a/release.sh +++ b/release.sh @@ -95,19 +95,15 @@ else fi fi -# leverage golang feature to support multiple binaries -# for example, 'go build -o xxx ./cmd/...' to generate multiple binaries' -if [[ "${INPUT_PROJECT_PATH}" =~ ^\./.*/\.\.\. ]]; then - MULTIPLE_BINARIES=TRUE -else - MULTIPLE_BINARIES= -fi # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) -if [ ! -z ${MULTIPLE_BINARIES} ]; then +if [ ${INPUT_MULTI_BINARIES} == "TRUE" ]; then RELEASE_ASSET_DIR=${BUILD_ARTIFACTS_FOLDER} mkdir -p ${RELEASE_ASSET_DIR} + + # leverage golang feature to support multiple binaries + # for example, 'go build -o xxx ./cmd/...' or 'go build -o xxx ./cmd/app1 ./cmd/app2' to generate multiple binaries' GOAMD64=${GOAMD64_FLAG} GOARM=${GOARM_FLAG} GOOS=${INPUT_GOOS} GOARCH=${INPUT_GOARCH} ${INPUT_BUILD_COMMAND} ${INPUT_BUILD_FLAGS} -o ${BUILD_ARTIFACTS_FOLDER} ${INPUT_PROJECT_PATH} else RELEASE_ASSET_DIR=${INPUT_PROJECT_PATH}/${BUILD_ARTIFACTS_FOLDER} @@ -140,7 +136,7 @@ fi if [ ! -z "${INPUT_EXTRA_FILES}" ]; then cd ${GITHUB_WORKSPACE} cp -r ${INPUT_EXTRA_FILES} ${RELEASE_ASSET_DIR}/ - if [ -z ${MULTIPLE_BINARIES} ]; then + if [ ! ${INPUT_MULTI_BINARIES} == "TRUE" ]; then cd ${INPUT_PROJECT_PATH} fi fi From 8da0de57f5f69875094d1c6148a5ea05fae4f182 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sat, 24 Feb 2024 02:48:21 +0000 Subject: [PATCH 10/13] test: more usage --- .github/workflows/autotest.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index c8990b4..0664210 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -207,6 +207,7 @@ jobs: matrix: goos: [linux, windows, darwin] goarch: [amd64] + project_path: [./test/multi-binaries/..., './test/multi-binaries/cmd1 ./test/multi-binaries/cmd2'] steps: - name: Set BUILD_TIME env run: echo BUILD_TIME=$(date -u +%Y%m%dT%H%M%S) >> ${GITHUB_ENV} @@ -218,7 +219,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} - project_path: ./test/multi-binaries/... + project_path: ${{ matrix.project_path }} pre_command: go mod init localtest extra_files: LICENSE README.md build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }} From 3205a402d0de71d82c3df4b9d217e3f8426bd9e3 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sat, 24 Feb 2024 02:54:15 +0000 Subject: [PATCH 11/13] fix: multi_binaries test --- .github/workflows/autotest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml index 0664210..b1fdf49 100644 --- a/.github/workflows/autotest.yml +++ b/.github/workflows/autotest.yml @@ -225,3 +225,4 @@ jobs: build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }} overwrite: true release_tag: v0.1-test-assets + multi_binaries: true From 4c764f330f8eec66860b3b007cd342ff9557b60d Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sat, 24 Feb 2024 02:54:52 +0000 Subject: [PATCH 12/13] doc: update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec1fd26..020051f 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ jobs: | goamd64 | **Optional** | `GOAMD64` is the running programs amd64 microarchitecture level, which is available since `go1.18`. It should only be used when `GOARCH` is `amd64`: one of `v1`, `v2`, `v3`, `v4`. | | goarm | **Optional** | `GOARM` is the running programs arm microarchitecture level, which is available since `go1.1`. It should only be used when `GOARCH` is `arm`: one of `5`, `6`, `7`, | | goversion | **Optional** | The `Go` compiler version. `latest`([check it here](https://go.dev/VERSION?m=text)) by default, optional `1.13`, `1.14`, `1.15`, `1.16`, `1.17`, `1.18`, `1.19`. You can also define a specific minor release, such as `1.19.5`.
Alternatively takes a download URL or a path to go.mod instead of version string. Make sure your URL references the `linux-amd64` package. You can find the URL on [Go - Downloads](https://go.dev/dl/).
e.g., `https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz`. | -| project_path | **Optional** | Where to run `go build`.
Use `.` by default.
Assume you have multiple binaries in your `repo/cmd`, you can use `project_path: ./cmd/...` to build multiple binaries and include them in one package. | +| project_path | **Optional** | Where to run `go build`.
Use `.` by default.
If enable `multi_binaries: true`, you can use `project_path: ./cmd/...` or `project_path: ./cmd/app1 ./cmd/app2` to build multiple binaries and include them in one package. | | binary_name | **Optional** | Specify another binary name if do not want to use repository basename.
Use your repository's basename if not set. | | pre_command | **Optional** | Extra command that will be executed before `go build`. You may want to use it to solve dependency if you're NOT using [Go Modules](https://github.com/golang/go/wiki/Modules). | | build_command | **Optional** | The actual command to build binary, typically `go build`. You may want to use other command wrapper, e.g., [packr2](https://github.com/gobuffalo/packr/tree/master/v2), example `build_command: 'packr2 build'`. Remember to use `pre_command` to set up `packr2` command in this scenario.
It also supports the `make`(`Makefile`) building system, example `build_command: make`. In this case both `build_flags` and `ldflags` will be ignored since they should be written in your `Makefile` already. Also, please make sure the generated binary placed in the path where `make` runs, i.e., `project_path`. | From 76e89e25cac684c929cdaf070d8f3ebca0a05f86 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sat, 24 Feb 2024 03:00:58 +0000 Subject: [PATCH 13/13] fix: syntax --- release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release.sh b/release.sh index e21bcc7..171e2bb 100755 --- a/release.sh +++ b/release.sh @@ -98,7 +98,7 @@ fi # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) -if [ ${INPUT_MULTI_BINARIES} == "TRUE" ]; then +if [ ${INPUT_MULTI_BINARIES^^} == 'TRUE' ]; then RELEASE_ASSET_DIR=${BUILD_ARTIFACTS_FOLDER} mkdir -p ${RELEASE_ASSET_DIR} @@ -136,7 +136,7 @@ fi if [ ! -z "${INPUT_EXTRA_FILES}" ]; then cd ${GITHUB_WORKSPACE} cp -r ${INPUT_EXTRA_FILES} ${RELEASE_ASSET_DIR}/ - if [ ! ${INPUT_MULTI_BINARIES} == "TRUE" ]; then + if [ ! ${INPUT_MULTI_BINARIES^^} == 'TRUE' ]; then cd ${INPUT_PROJECT_PATH} fi fi