From 52c0aad0722a030e0077d08f6229814dd64cf46c Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Thu, 12 May 2022 13:49:17 +0800 Subject: [PATCH 01/24] Use github token Signed-off-by: Billy Zha --- .github/workflows/release-github.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 60e390204..df82c29d7 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -21,4 +21,4 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_USER_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 885174e2ec766ba3d72af4698e7163dc19ab2e83 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Thu, 12 May 2022 14:05:29 +0800 Subject: [PATCH 02/24] User github token for ghcr Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index bae389ca4..304313e62 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -28,8 +28,7 @@ jobs: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ secrets.RELEASE_GHCR_USER_NAME }} - password: ${{ secrets.RELEASE_GHCR_USER_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: docker push run: | docker push ${{ steps.prepare.outputs.ref }} From 7abcbba8233d2e841fa16675cfa02b8c25a738bd Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Thu, 12 May 2022 14:13:56 +0800 Subject: [PATCH 03/24] Update GHCR release config Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 304313e62..f5bf8ee56 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -25,10 +25,11 @@ jobs: run: | docker build -t ${{ steps.prepare.outputs.ref }} . - name: docker login - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io - repo-token: ${{ secrets.GITHUB_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: docker push run: | docker push ${{ steps.prepare.outputs.ref }} From dc15376526ea25d81f77a20dcb39b2f0dc2d976b Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 01:31:29 +0800 Subject: [PATCH 04/24] Build multi-arch image Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 7 ++++--- Dockerfile | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index bae389ca4..6ac8c7cce 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -21,15 +21,16 @@ jobs: fi echo ::set-output name=version::${VERSION} echo ::set-output name=ref::ghcr.io/${{ github.repository }}:${VERSION} - - name: docker build - run: | - docker build -t ${{ steps.prepare.outputs.ref }} . - name: docker login uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ secrets.RELEASE_GHCR_USER_NAME }} password: ${{ secrets.RELEASE_GHCR_USER_TOKEN }} + - name: docker build + run: | + docker buildx create --use --name build --node build --driver-opt network=host + docker buildx build --platform linux/amd64,linux/arm64,darwin/arm64 -t ${{ steps.prepare.outputs.ref }} --push . - name: docker push run: | docker push ${{ steps.prepare.outputs.ref }} diff --git a/Dockerfile b/Dockerfile index d67c740c5..030957a42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ FROM docker.io/library/golang:1.18.1-alpine as builder +ARG TARGETPLATFORM RUN apk add git make ENV ORASPKG /oras ADD . ${ORASPKG} WORKDIR ${ORASPKG} -RUN make build-linux -RUN mv ${ORASPKG}/bin/linux/amd64/oras /go/bin/oras +RUN make build +RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras FROM docker.io/library/alpine:3.13.5 LABEL maintainer="shizh@microsoft.com" From 9853ff8a0e29fa90c401c60a59d80eab1d103441 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 11:09:51 +0800 Subject: [PATCH 05/24] Add arm32 build Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- Makefile | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 6bf97c956..96eab8341 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -30,7 +30,7 @@ jobs: - name: docker build run: | docker buildx create --use --name build --node build --driver-opt network=host - docker buildx build --platform linux/amd64,linux/arm64,darwin/arm64 -t ${{ steps.prepare.outputs.ref }} --push . + docker buildx build --platform linux/amd64,linux/arm64,,linux/arm32 -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() run: | diff --git a/Makefile b/Makefile index f1e663b98..455b208ef 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux build-linux-arm64 build-mac build-mac-arm64 build-windows +build: build-linux build-linux-arm64 build-linux-arm32 build-mac build-mac-arm64 build-windows .PHONY: build-linux build-linux: @@ -42,6 +42,11 @@ build-linux-arm64: GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/arm64/$(CLI_EXE) $(CLI_PKG) +.PHONY: build-linux-arm32 +build-linux-arm64: + GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ + -o bin/linux/arm32/$(CLI_EXE) $(CLI_PKG) + .PHONY: build-mac build-mac: GOARCH=amd64 CGO_ENABLED=0 GOOS=darwin go build -v --ldflags="$(LDFLAGS)" \ From c1f738260c6b61e1f4943a6579dc6ebbf456d123 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 11:22:07 +0800 Subject: [PATCH 06/24] Code clean Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 96eab8341..8f588f1be 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -30,7 +30,7 @@ jobs: - name: docker build run: | docker buildx create --use --name build --node build --driver-opt network=host - docker buildx build --platform linux/amd64,linux/arm64,,linux/arm32 -t ${{ steps.prepare.outputs.ref }} --push . + docker buildx build --platform linux/amd64,linux/arm64,linux/arm32 -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() run: | From 440e4e02b21eaf378eb75f7a79a536aef8c29e69 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 11:59:24 +0800 Subject: [PATCH 07/24] Rename arm32 build Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 8f588f1be..6676cd420 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -30,7 +30,7 @@ jobs: - name: docker build run: | docker buildx create --use --name build --node build --driver-opt network=host - docker buildx build --platform linux/amd64,linux/arm64,linux/arm32 -t ${{ steps.prepare.outputs.ref }} --push . + docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() run: | diff --git a/Makefile b/Makefile index 455b208ef..51a045d3b 100644 --- a/Makefile +++ b/Makefile @@ -43,9 +43,9 @@ build-linux-arm64: -o bin/linux/arm64/$(CLI_EXE) $(CLI_PKG) .PHONY: build-linux-arm32 -build-linux-arm64: +build-linux-arm32: GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ - -o bin/linux/arm32/$(CLI_EXE) $(CLI_PKG) + -o bin/linux/arm/$(CLI_EXE) $(CLI_PKG) .PHONY: build-mac build-mac: From 3f4bb3ca6380a133cd1bc7ae758828eb7a7c808a Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 13:55:39 +0800 Subject: [PATCH 08/24] Add v5 v7 builds Signed-off-by: Billy Zha --- Dockerfile | 2 +- Makefile | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 030957a42..7b271719b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ RUN apk add git make ENV ORASPKG /oras ADD . ${ORASPKG} WORKDIR ${ORASPKG} -RUN make build +RUN make build-linux RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras FROM docker.io/library/alpine:3.13.5 diff --git a/Makefile b/Makefile index 51a045d3b..e72c18938 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,15 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux build-linux-arm64 build-linux-arm32 build-mac build-mac-arm64 build-windows +build: build-linux build-linux-arm64 build-linux-arm32 build-mac \ + build-mac-arm64 build-windows .PHONY: build-linux build-linux: + build-linux-amd64 build-linux-arm64 build-linux-arm32 + +.PHONY: build-linux-amd64 +build-linux-amd64: GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/amd64/$(CLI_EXE) $(CLI_PKG) @@ -46,6 +51,10 @@ build-linux-arm64: build-linux-arm32: GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/arm/$(CLI_EXE) $(CLI_PKG) + mkdir bin/darwin/arm/v5 && ln bin/linux/arm/$(CLI_EXE) \ + bin/linux/arm/v5/$(CLI_EXE) + mkdir bin/darwin/arm/v7 && ln bin/linux/arm/$(CLI_EXE) \ + bin/linux/arm/v7/$(CLI_EXE) .PHONY: build-mac build-mac: From 885c0dd895d8b76db7a084369e3f9032ad7daab7 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 14:13:20 +0800 Subject: [PATCH 09/24] Update makefile Signed-off-by: Billy Zha --- Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e72c18938..14250a212 100644 --- a/Makefile +++ b/Makefile @@ -30,12 +30,10 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux build-linux-arm64 build-linux-arm32 build-mac \ - build-mac-arm64 build-windows +build: build-linux build-mac build-mac-arm64 build-windows .PHONY: build-linux -build-linux: - build-linux-amd64 build-linux-arm64 build-linux-arm32 +build-linux: build-linux-amd64 build-linux-arm64 build-linux-arm32 .PHONY: build-linux-amd64 build-linux-amd64: @@ -51,9 +49,9 @@ build-linux-arm64: build-linux-arm32: GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/arm/$(CLI_EXE) $(CLI_PKG) - mkdir bin/darwin/arm/v5 && ln bin/linux/arm/$(CLI_EXE) \ + mkdir -p bin/linux/arm/v5 && ln -f bin/linux/arm/$(CLI_EXE) \ bin/linux/arm/v5/$(CLI_EXE) - mkdir bin/darwin/arm/v7 && ln bin/linux/arm/$(CLI_EXE) \ + mkdir -p bin/linux/arm/v7 && ln -f bin/linux/arm/$(CLI_EXE) \ bin/linux/arm/v7/$(CLI_EXE) .PHONY: build-mac From 4682de856f7ae2ba9710f930aa816d5c06a8ebbf Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 17:12:01 +0800 Subject: [PATCH 10/24] Test if variant works Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 6676cd420..538e1a9ce 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -30,7 +30,7 @@ jobs: - name: docker build run: | docker buildx create --use --name build --node build --driver-opt network=host - docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t ${{ steps.prepare.outputs.ref }} --push . + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v5 -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() run: | From 7792317ce05a23f02c2a362237389426e5fc6959 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 17:14:50 +0800 Subject: [PATCH 11/24] Remove v5 Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 538e1a9ce..163b36c63 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -30,7 +30,7 @@ jobs: - name: docker build run: | docker buildx create --use --name build --node build --driver-opt network=host - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v5 -t ${{ steps.prepare.outputs.ref }} --push . + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() run: | From 2c83be38af217e1818a1b551544a52a492e272e7 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 17:33:04 +0800 Subject: [PATCH 12/24] Clean makefile Signed-off-by: Billy Zha --- Dockerfile | 3 +-- Makefile | 19 ++++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b271719b..a9f9c1ada 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,11 +4,10 @@ RUN apk add git make ENV ORASPKG /oras ADD . ${ORASPKG} WORKDIR ${ORASPKG} -RUN make build-linux +RUN make build-$(echo $TARGETPLATFORM | sed 's/\//-/g') RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras FROM docker.io/library/alpine:3.13.5 -LABEL maintainer="shizh@microsoft.com" RUN apk --update add ca-certificates COPY --from=builder /go/bin/oras /bin/oras RUN mkdir /workspace diff --git a/Makefile b/Makefile index 14250a212..5442dbad2 100644 --- a/Makefile +++ b/Makefile @@ -30,13 +30,10 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux build-mac build-mac-arm64 build-windows +build: build-linux build-linux-arm64 build-mac build-mac-arm64 build-windows .PHONY: build-linux -build-linux: build-linux-amd64 build-linux-arm64 build-linux-arm32 - -.PHONY: build-linux-amd64 -build-linux-amd64: +build-linux: GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/amd64/$(CLI_EXE) $(CLI_PKG) @@ -45,14 +42,10 @@ build-linux-arm64: GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/arm64/$(CLI_EXE) $(CLI_PKG) -.PHONY: build-linux-arm32 -build-linux-arm32: - GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ - -o bin/linux/arm/$(CLI_EXE) $(CLI_PKG) - mkdir -p bin/linux/arm/v5 && ln -f bin/linux/arm/$(CLI_EXE) \ - bin/linux/arm/v5/$(CLI_EXE) - mkdir -p bin/linux/arm/v7 && ln -f bin/linux/arm/$(CLI_EXE) \ - bin/linux/arm/v7/$(CLI_EXE) +.PHONY: build-linux-arm-v7 +build-linux-arm-v7: + GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ + -o bin/linux/arm/v7/$(CLI_EXE) $(CLI_PKG) .PHONY: build-mac build-mac: From f56b880fb1abf36e9a834e2dc403f93f292e9908 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 17:48:25 +0800 Subject: [PATCH 13/24] Rename Signed-off-by: Billy Zha --- .github/workflows/build-pr.yml | 2 +- .github/workflows/build.yml | 2 +- Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index dcf2aaa3a..bab4e51e7 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -16,6 +16,6 @@ jobs: with: go-version: '1.18.1' - name: Build CLI - run: make build-linux + run: make build-linux-amd64 - name: Check version run: bin/linux/amd64/oras version diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bc3c89ec..55f0b96c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,6 @@ jobs: with: go-version: '1.18.1' - name: Build CLI - run: make build-linux + run: make build-linux-amd64 - name: Check version run: bin/linux/amd64/oras version diff --git a/Makefile b/Makefile index 5442dbad2..60d5e77d9 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,9 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux build-linux-arm64 build-mac build-mac-arm64 build-windows +build: build-linux-amd64 build-linux-arm64 build-mac build-mac-arm64 build-windows -.PHONY: build-linux +.PHONY: build-linux-amd64 build-linux: GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/amd64/$(CLI_EXE) $(CLI_PKG) From 5e852c62b07df50d1d168c0c99487d4bda3d3c43 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 18:05:37 +0800 Subject: [PATCH 14/24] Make ondemand Signed-off-by: Billy Zha --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a9f9c1ada..d9e846c2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ RUN apk add git make ENV ORASPKG /oras ADD . ${ORASPKG} WORKDIR ${ORASPKG} -RUN make build-$(echo $TARGETPLATFORM | sed 's/\//-/g') +RUN make "build-$(echo $TARGETPLATFORM | sed 's/\//-/g')" RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras FROM docker.io/library/alpine:3.13.5 From 8259fa55d9d8e818801b465e731a4814d7dc2cc0 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Fri, 13 May 2022 19:42:47 +0800 Subject: [PATCH 15/24] Correct makefile Signed-off-by: Billy Zha --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 60d5e77d9..541264271 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean: build: build-linux-amd64 build-linux-arm64 build-mac build-mac-arm64 build-windows .PHONY: build-linux-amd64 -build-linux: +build-linux-amd64: GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -v --ldflags="$(LDFLAGS)" \ -o bin/linux/amd64/$(CLI_EXE) $(CLI_PKG) From e6b148638b90058ba4d61b36648f76bb171c99b2 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 15:21:52 +0800 Subject: [PATCH 16/24] Upgrade alpine version Signed-off-by: Billy Zha --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d9e846c2c..3b2eb0382 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR ${ORASPKG} RUN make "build-$(echo $TARGETPLATFORM | sed 's/\//-/g')" RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras -FROM docker.io/library/alpine:3.13.5 +FROM docker.io/library/alpine:3.15.4 RUN apk --update add ca-certificates COPY --from=builder /go/bin/oras /bin/oras RUN mkdir /workspace From bba32a30c5b320419f40afcb78ea4142bde7b778 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 15:36:29 +0800 Subject: [PATCH 17/24] Upgrade go setup job version Signed-off-by: Billy Zha --- .github/workflows/release-github.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index df82c29d7..08c258e80 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v2 with: go-version: '1.18.1' - name: run goreleaser From fce4ed67018468e3d19a8ff467b5d42ceae220a7 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 15:38:56 +0800 Subject: [PATCH 18/24] Group builds & refine dockerfile Signed-off-by: Billy Zha --- Dockerfile | 2 +- Makefile | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b2eb0382..5a99c4280 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ RUN apk add git make ENV ORASPKG /oras ADD . ${ORASPKG} WORKDIR ${ORASPKG} -RUN make "build-$(echo $TARGETPLATFORM | sed 's/\//-/g')" +RUN make "build-$(echo $TARGETPLATFORM | tr / -)" RUN mv ${ORASPKG}/bin/${TARGETPLATFORM}/oras /go/bin/oras FROM docker.io/library/alpine:3.15.4 diff --git a/Makefile b/Makefile index 541264271..32f4e1444 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,10 @@ clean: git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf .PHONY: build -build: build-linux-amd64 build-linux-arm64 build-mac build-mac-arm64 build-windows +build: build-linux build-mac build-windows + +.PHONY: build-linux +build-linux: build-linux-amd64 build-linux-arm64 build-linux-arm-v7 .PHONY: build-linux-amd64 build-linux-amd64: @@ -48,6 +51,9 @@ build-linux-arm-v7: -o bin/linux/arm/v7/$(CLI_EXE) $(CLI_PKG) .PHONY: build-mac +build-mac: build-mac-arm64 build-mac-amd64 + +.PHONY: build-mac-amd64 build-mac: GOARCH=amd64 CGO_ENABLED=0 GOOS=darwin go build -v --ldflags="$(LDFLAGS)" \ -o bin/darwin/amd64/$(CLI_EXE) $(CLI_PKG) From 0a6bf91e106b3911a888e4d46e161cbc59308424 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 15:39:33 +0800 Subject: [PATCH 19/24] Remove unused flags for builx Signed-off-by: Billy Zha --- .github/workflows/release-ghcr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 163b36c63..3a93442be 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -29,7 +29,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: docker build run: | - docker buildx create --use --name build --node build --driver-opt network=host + docker buildx create --use docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ${{ steps.prepare.outputs.ref }} --push . - name: clear if: always() From beb35157d16e96417f658f780e0b0fd4f242be56 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 15:49:07 +0800 Subject: [PATCH 20/24] Upgrade action versions Signed-off-by: Billy Zha --- .github/workflows/build-pr.yml | 4 ++-- .github/workflows/build.yml | 4 ++-- .github/workflows/release-ghcr.yml | 2 +- .github/workflows/release-github.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index bab4e51e7..6d3352d14 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -10,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v3 with: go-version: '1.18.1' - name: Build CLI diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55f0b96c0..3683e242f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v3 with: go-version: '1.18.1' - name: Build CLI diff --git a/.github/workflows/release-ghcr.yml b/.github/workflows/release-ghcr.yml index 3a93442be..2ed5c401e 100644 --- a/.github/workflows/release-ghcr.yml +++ b/.github/workflows/release-ghcr.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: prepare id: prepare run: | diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 08c258e80..9a0f7fb54 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -10,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: setup go environment - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18.1' - name: run goreleaser From 961e2d08625a5c1095df032b590507e85afb03f2 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 16:10:41 +0800 Subject: [PATCH 21/24] Add arm32 builds for linux Signed-off-by: Billy Zha --- .goreleaser.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 06e583938..53850f5a2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,9 +13,14 @@ builds: goarch: - amd64 - arm64 + - arm ignore: - goos: windows goarch: arm64 + - goos: windows + goarch: arm + - goos: darwin + goarch: arm ldflags: # one-line ldflags to bypass the goreleaser bugs # the git tree state is guaranteed to be clean by goreleaser From 65082be160c5afcf44fd45812768a86209750cfc Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 16:53:58 +0800 Subject: [PATCH 22/24] build v7 Signed-off-by: Billy Zha --- .goreleaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 53850f5a2..6a76a670d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,6 +14,8 @@ builds: - amd64 - arm64 - arm + goarm: + - '7' ignore: - goos: windows goarch: arm64 From 112fd87dc6c4a6dc5266f3ed3b095c691a80e5ef Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 16 May 2022 17:25:17 +0800 Subject: [PATCH 23/24] Add release info Signed-off-by: Billy Zha --- .goreleaser.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 6a76a670d..2f8c64656 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -36,6 +36,9 @@ archives: - goos: windows format: zip +release: + draft: true + prerelease: auto #signs: # - artifacts: all # args: ["--output", "${signature}", "--detach-sign", "--armor", "${artifact}"] From 41a5972b44a815fb8d63376aaa569e63924ff189 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Tue, 17 May 2022 11:19:31 +0800 Subject: [PATCH 24/24] Fix typo Signed-off-by: Billy Zha --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 32f4e1444..f0f0c1daf 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ build-linux-arm-v7: build-mac: build-mac-arm64 build-mac-amd64 .PHONY: build-mac-amd64 -build-mac: +build-mac-amd64: GOARCH=amd64 CGO_ENABLED=0 GOOS=darwin go build -v --ldflags="$(LDFLAGS)" \ -o bin/darwin/amd64/$(CLI_EXE) $(CLI_PKG)