File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 4343 registry : quay.io
4444 - name : build and push manifest with images
4545 run : MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.tag }} CLEAN_BUILD=1 make images
46+ - name : extract binaries
47+ run : MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.tag }} make extract-binaries
48+ - name : create draft release
49+ id : create_release
50+ uses : actions/create-release@v1
51+ env :
52+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53+ with :
54+ tag_name : ${{ env.tag }}
55+ release_name : ${{ env.tag }}
56+ draft : true
57+ prerelease : false
58+ - name : upload binaries
59+ uses : actions/github-script@v2
60+ with :
61+ github-token : ${{secrets.GITHUB_TOKEN}}
62+ script : |
63+ const fs = require('fs').promises;
64+ const upload_url = '${{ steps.create_release.outputs.upload_url }}';
65+ for (let file of await fs.readdir('./release-assets')) {
66+ console.log('uploading', file);
67+ await github.repos.uploadReleaseAsset({
68+ url: upload_url,
69+ name: file,
70+ data: await fs.readFile(`./release-assets/${file}`)
71+ });
72+ }
Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ define manifest_add_target
6969 DOCKER_BUILDKIT=1 $(OCI_BIN ) manifest add ${IMAGE} ${IMAGE}-$(1 ) ;
7070endef
7171
72+ # extract a single arch target binary
73+ define extract_target
74+ echo 'extracting binary from ${IMAGE}-$(1 ) '; \
75+ $(OCI_BIN ) create --name flp ${IMAGE}-$(1 ) ; \
76+ $(OCI_BIN ) cp flp:/app/flowlogs-pipeline ./release-assets/flowlogs-pipeline-${VERSION}-linux-$(1 ) ; \
77+ $(OCI_BIN ) rm -f flp;
78+ endef
79+
7280# #@ General
7381
7482# The help target prints out all targets with their descriptions organized
@@ -197,5 +205,11 @@ else
197205 DOCKER_BUILDKIT=1 $(OCI_BIN) manifest push ${IMAGE} docker://${IMAGE};
198206endif
199207
208+ .PHONY : extract-binaries
209+ extract-binaries : # # Extract all MULTIARCH_TARGETS binaries
210+ trap ' exit' INT; \
211+ mkdir -p release-assets; \
212+ $(foreach target,$(MULTIARCH_TARGETS ) ,$(call extract_target,$(target ) ) )
213+
200214include .mk/development.mk
201215include .mk/shortcuts.mk
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ COPY vendor/ vendor/
1212COPY cmd/ cmd/
1313COPY pkg/ pkg/
1414
15- RUN GOARCH=$TARGETARCH go build -ldflags "$LDFLAGS" -mod vendor -o flowlogs-pipeline cmd/flowlogs-pipeline/main.go
15+ RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -ldflags "$LDFLAGS" -mod vendor -o flowlogs-pipeline cmd/flowlogs-pipeline/main.go
1616
1717# final stage
1818FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.5-1742914212
You can’t perform that action at this time.
0 commit comments