Added release-bins flow to release binaries in *.tar.gz archive on release tag - #288
Added release-bins flow to release binaries in *.tar.gz archive on release tag#288pasquale95 wants to merge 2 commits into
*.tar.gz archive on release tag#288Conversation
…GitHub Signed-off-by: pco <pasquale.convertini@ibm.com>
Signed-off-by: pco <pasquale.convertini@ibm.com>
mbrandenburger
left a comment
There was a problem hiding this comment.
Thank you @pasquale95 for this PR! Great stuff! Please see my comments below.
| env: | ||
| TARGET: ${{ matrix.os }}-${{ matrix.arch }} | ||
| RELEASE: ${{ needs.prepare.outputs.tag }} | ||
| REVISION: ${{ github.sha }} |
There was a problem hiding this comment.
I am wondering if github.sha is correct here as it might not match the tag version we are trying to build here. If you just drop it here, your script will default to git rev-parse HEAD, which is in any case the correct checkout out version. Can we double check this somehow?
| $(RELEASE_DIR)/%: GO_LDFLAGS = $(METADATA_VAR:%=-X $(PKGNAME)/common/metadata.%) | ||
| $(RELEASE_DIR)/%: |
There was a problem hiding this comment.
Do we need to add a FORCE prerequisite to ensure that we correctly rebuilding?!
| $(RELEASE_DIR)/%: | ||
| @echo "Building $@" | ||
| @mkdir -p $(@D) | ||
| CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(go_cmd) build -trimpath \ |
There was a problem hiding this comment.
Can you check that these go flags are consistent with the docker-based builds, in particular the use of cgo?
| RELEASE_BIN_DIR = $(RELEASE_DIR)/$(GOOS)-$(GOARCH)/bin | ||
|
|
||
| .PHONY: release-bins | ||
| release-bins: $(TOOLS_EXES:%=$(RELEASE_BIN_DIR)/%) ## Cross-compiles all tools for $(GOOS)/$(GOARCH) into $(RELEASE_DIR) |
There was a problem hiding this comment.
I am wondering what we should do with idemixgen as this is part of the docker-based build. It's kind of inconsistent.
| - name: Publish release assets | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ needs.prepare.outputs.tag }} |
There was a problem hiding this comment.
depending on the tag, we may want to set prerelease: true, for instance, on a tag like v1.2.0-rc1. Something like prerelease: ${{ contains(needs.prepare.outputs.tag, '-') }} could help.
| runs-on: ubuntu-latest | ||
| outputs: | ||
| tag: ${{ steps.extract.outputs.tag }} | ||
| version: ${{ steps.extract.outputs.version }} |
There was a problem hiding this comment.
do we use the version output?
| RELEASE_DIR="release/${TARGET}" | ||
| echo "Building ${TARGET} binaries for ${RELEASE} (${REVISION})..." | ||
| make release-bins GOOS="${GOOS}" GOARCH="${GOARCH}" RELEASE_DIR=release \ | ||
| METADATA_VAR="Version=${VERSION} CommitSHA=${REVISION}" |
There was a problem hiding this comment.
it seems that the script assumes we run it from the root folder. If invoked from the script folder it won't be happy. Probably ok - maybe some more bash magic needed to make this more robust?
| GOOS ?= $(shell go env GOOS) | ||
| GOARCH ?= $(shell go env GOARCH) |
There was a problem hiding this comment.
| GOOS ?= $(shell go env GOOS) | |
| GOARCH ?= $(shell go env GOARCH) | |
| # Resolved on first use and then cached, so `go env` is never invoked for | |
| # targets that don't need it (help, lint, test) nor when GOOS/GOARCH are preset. | |
| GOOS ?= $(eval GOOS := $(shell $(go_cmd) env GOOS))$(GOOS) | |
| GOARCH ?= $(eval GOARCH := $(shell $(go_cmd) env GOARCH))$(GOARCH) |
| .PHONY: release-bins | ||
| release-bins: $(TOOLS_EXES:%=$(RELEASE_BIN_DIR)/%) ## Cross-compiles all tools for $(GOOS)/$(GOARCH) into $(RELEASE_DIR) |
There was a problem hiding this comment.
| .PHONY: release-bins | |
| release-bins: $(TOOLS_EXES:%=$(RELEASE_BIN_DIR)/%) ## Cross-compiles all tools for $(GOOS)/$(GOARCH) into $(RELEASE_DIR) | |
| # The per-binary targets are named in the recipe rather than in the prerequisite | |
| # list: prerequisites are expanded when the makefile is parsed, which would | |
| # resolve GOOS/GOARCH on every make invocation. | |
| .PHONY: release-bins | |
| release-bins: ## Cross-compiles all tools for $(GOOS)/$(GOARCH) into $(RELEASE_DIR) | |
| @$(MAKE) --no-print-directory GOOS=$(GOOS) GOARCH=$(GOARCH) \ | |
| $(TOOLS_EXES:%=$(RELEASE_BIN_DIR)/%) |
Type of change
Description
Ship prebuilt
fabric-x-toolsCLI binaries (configtxgen,configtxlator,cryptogen,fxconfig) as GitHub Release assets whenever av*tag is pushed, mirroring the existingfabric-x-toolsimage release but for users who don't want to run a container.None of the four tools depend on cgo, so all platforms cross-compile from a single
ubuntu-latestrunner (no QEMU, no macOS runner needed):linux/amd64,linux/arm64,linux/s390x— same as thefabric-x-toolsimagedarwin/amd64,darwin/arm64— for macOS users, since the image only ever runs on LinuxChanges:
Makefile: newrelease-binstarget that cross-compiles the tools viago build(the existingbin/%rule usesgo install, which can't cross-compile) and stampsVersion/CommitSHAviaMETADATA_VAR— previously unused, so released binaries now report their real version instead oflatest.scripts/create-binary-package.sh: builds one<os>-<arch>target and packages it intofabric-x-tools-<target>-<version>.tar.gz(bin/ + LICENSE)..github/workflows/release-binaries.yml: new workflow, independent ofbuild-image.yml. Validates the tag, builds the 5-platform matrix, generateschecksums.txt, and publishes everything to the tag's GitHub Release viasoftprops/action-gh-release@v2(same action used by thefabric-x-ansible-collectionrelease workflow). Also supports manual re-runs viaworkflow_dispatch.