From 4c50103fe6e6842ad7c74eb47aafcafb9e4b0a42 Mon Sep 17 00:00:00 2001 From: Lework Date: Tue, 2 Apr 2024 15:32:37 +0800 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a07bc0..5989051 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,10 @@ jobs: tags="$(git ls-remote --tags $APP_REPO | grep 'v[1-9]\.[0-9]*\.[0-9]*$' | awk -F'tags/' '{print $2}' | sort -t. -k1,1n -k2,2n -k3,3n)" new_tags="$(printf "%s" "$tags"| sed -n '{/\.0$/{g;p}};h' | tail -4) $(printf "%s" "$tags" | tail -1)" echo "::debug::[Tags] $new_tags" + + # golang:1.20-alpine3.16 + build_image="golang:1.20-alpine3.16" + docker pull "${build_image}" for t in $new_tags; do echo "[check] $t" @@ -41,17 +45,18 @@ jobs: git checkout -b $t $t git branch - # golang:1.19.2-alpine3.16 - docker pull golang:1.19.2-alpine3.16 # Linux builds - docker run --rm -t -v $PWD:/build golang:1.19.2-alpine3.16 sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -mod=vendor '-buildmode=pie' -ldflags '-extldflags -static' -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-linux-amd64 ./cmd/skopeo && md5sum ./bin/skopeo-linux-amd64 > ./bin/skopeo-linux-amd64.md5 && sha256sum ./bin/skopeo-linux-amd64 > ./bin/skopeo-linux-amd64.sha256" + docker run --rm -t -v $PWD:/build "${build_image}" sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -mod=vendor '-buildmode=pie' -ldflags '-extldflags -static' -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-linux-amd64 ./cmd/skopeo && md5sum ./bin/skopeo-linux-amd64 > ./bin/skopeo-linux-amd64.md5 && sha256sum ./bin/skopeo-linux-amd64 > ./bin/skopeo-linux-amd64.sha256" - docker run --rm -t -v $PWD:/build golang:1.19.2-alpine3.16 sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -mod=vendor '-buildmode=pie' -ldflags '-extldflags -static' -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-linux-arm64 ./cmd/skopeo && md5sum ./bin/skopeo-linux-arm64 > ./bin/skopeo-linux-arm64.md5 && sha256sum ./bin/skopeo-linux-arm64 > ./bin/skopeo-linux-arm64.sha256" + docker run --rm -t -v $PWD:/build "${build_image}" sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=linux GOARCH=arm64 go build -mod=vendor '-buildmode=pie' -ldflags '-extldflags -static' -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-linux-arm64 ./cmd/skopeo && md5sum ./bin/skopeo-linux-arm64 > ./bin/skopeo-linux-arm64.md5 && sha256sum ./bin/skopeo-linux-arm64 > ./bin/skopeo-linux-arm64.sha256" + docker run --rm -t -v $PWD:/build "${build_image}" sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=linux GOARCH=ppc64le go build -mod=vendor '-buildmode=pie' -ldflags '-extldflags -static' -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-linux-ppc64le ./cmd/skopeo && md5sum ./bin/skopeo-linux-ppc64le > ./bin/skopeo-linux-ppc64le.md5 && sha256sum ./bin/skopeo-linux-ppc64le > ./bin/skopeo-linux-ppc64le.sha256" + # Darwin builds - docker run --rm -t -v $PWD:/build golang:1.19.2-alpine3.16 sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -mod=vendor -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-darwin-amd64 ./cmd/skopeo && md5sum ./bin/skopeo-darwin-amd64 > ./bin/skopeo-darwin-amd64.md5 && sha256sum ./bin/skopeo-darwin-amd64 > ./bin/skopeo-darwin-amd64.sha256" + docker run --rm -t -v $PWD:/build "${build_image}" sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -mod=vendor -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-darwin-amd64 ./cmd/skopeo && md5sum ./bin/skopeo-darwin-amd64 > ./bin/skopeo-darwin-amd64.md5 && sha256sum ./bin/skopeo-darwin-amd64 > ./bin/skopeo-darwin-amd64.sha256" + + docker run --rm -t -v $PWD:/build "${build_image}" sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -mod=vendor -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-darwin-arm64 ./cmd/skopeo && md5sum ./bin/skopeo-darwin-arm64 > ./bin/skopeo-darwin-arm64.md5 && sha256sum ./bin/skopeo-darwin-arm64 > ./bin/skopeo-darwin-arm64.sha256" - docker run --rm -t -v $PWD:/build golang:1.19.2-alpine3.16 sh -c "apk update && apk add gpgme btrfs-progs-dev llvm13-dev gcc musl-dev && cd /build && CGO_ENABLE=0 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -mod=vendor -gcflags '' -tags 'exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -o ./bin/skopeo-darwin-arm64 ./cmd/skopeo && md5sum ./bin/skopeo-darwin-arm64 > ./bin/skopeo-darwin-arm64.md5 && sha256sum ./bin/skopeo-darwin-arm64 > ./bin/skopeo-darwin-arm64.sha256" ls -al bin/ cd ../ ls -al ./ @@ -66,6 +71,7 @@ jobs: git commit -m "$APP $ADD_TAG (Github Actions Automatically Built in `date +"%Y-%m-%d %H:%M"`)" echo "ADD_TAG=${ADD_TAG}" >> $GITHUB_OUTPUT cat ./skopeo/bin/skopeo-{darwin,linux}-{amd64,arm64}.{md5,sha256} > CHECKSUMS.txt + cat ./skopeo/bin/skopeo-linux-ppc64le.{md5,sha256} > CHECKSUMS.txt echo "::endgroup::" popd break @@ -92,6 +98,9 @@ jobs: ./skopeo/bin/skopeo-linux-arm64 ./skopeo/bin/skopeo-linux-arm64.md5 ./skopeo/bin/skopeo-linux-arm64.sha256 + ./skopeo/bin/skopeo-linux-ppc64le + ./skopeo/bin/skopeo-linux-ppc64le.md5 + ./skopeo/bin/skopeo-linux-ppc64le.sha256 ./skopeo/bin/skopeo-darwin-amd64 ./skopeo/bin/skopeo-darwin-amd64.md5 ./skopeo/bin/skopeo-darwin-amd64.sha256