From 50a0831f1b5fc94a06b66376b63cc0b99a76737c Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani Date: Wed, 15 Dec 2021 22:14:53 +0000 Subject: [PATCH] ci/cd: fix github workflow to upload release binaries Fixes issue #332 Signed-off-by: Ramkumar Chinchani --- .github/workflows/ci-cd.yml | 12 +++++++----- Makefile | 10 +++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 8859910a..3a15885e 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -46,7 +46,7 @@ jobs: - name: Run build and test timeout-minutes: 30 run: | - cd $GITHUB_WORKSPACE && make + cd $GITHUB_WORKSPACE && make && make ARCH=arm64 binary-arch-minimal && make ARCH=arm64 binary-arch env: S3MOCK_ENDPOINT: localhost:4566 AWS_ACCESS_KEY_ID: fake @@ -57,11 +57,13 @@ jobs: - if: github.event_name == 'release' && github.event.action == 'published' name: Publish artifacts on releases - uses: Roang-zero1/github-upload-release-artifacts-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: svenstaro/upload-release-action@v2 with: - args: bin/zot* + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: bin/zot* + tag: ${{ github.ref }} + overwrite: true + file_glob: true push-image: if: github.event_name == 'release' && github.event.action== 'published' diff --git a/Makefile b/Makefile index 34311b77..bdaf6698 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ OS ?= linux ARCH ?= amd64 .PHONY: all -all: swagger binary binary-minimal binary-debug exporter-minimal test test-clean check +all: swagger binary binary-minimal binary-debug binary-arch binary-arch-minimal exporter-minimal test test-clean check .PHONY: binary-minimal binary-minimal: swagger @@ -25,6 +25,14 @@ binary: swagger binary-debug: swagger env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-debug -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot +.PHONY: binary-arch-minimal +binary-arch-minimal: swagger + env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(ARCH)-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot + +.PHONY: binary-arch +binary-arch: swagger + env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot + .PHONY: exporter-minimal exporter-minimal: swagger env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter