From f1fc6c6861c078d536eed53801a50c61890d9bee Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sat, 16 Sep 2023 15:17:31 -0400 Subject: [PATCH] Prepare source archive releases --- .bcr/source.template.json | 2 +- .github/workflows/build.yml | 30 ------------------------------ .github/workflows/build_release.sh | 15 +++++++++++++++ .github/workflows/release.yml | 27 +++++++++++++++++++++++++++ MODULE.bazel | 2 +- 5 files changed, 44 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100755 .github/workflows/build_release.sh create mode 100644 .github/workflows/release.yml diff --git a/.bcr/source.template.json b/.bcr/source.template.json index e25974e..fd9e5d8 100644 --- a/.bcr/source.template.json +++ b/.bcr/source.template.json @@ -1,5 +1,5 @@ { "integrity": "", "strip_prefix": "aws-in-a-box-{VERSION}", - "url": "https://github.com/dzbarsky/aws-in-a-box/archive/refs/tags/{TAG}.tar.gz" + "url": "https://github.com/dzbarsky/aws-in-a-box/releases/download/{VERSION}/aws-in-a-box-{TAG}.tar.gz" } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 876d16d..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: build-release - -on: - push: - tags: - - "v*.*.*" - -jobs: - release: - strategy: - matrix: - go_os: [windows, linux, darwin] - go_arch: [amd64, arm64] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - - name: Build - run: GOOS=${{ matrix.go_os }} GOARCH=${{ matrix.go_arch }} CGO_ENABLED=0 go build -ldflags "-w" -trimpath -o ./aws-in-a-box-${{ matrix.go_os }}-${{ matrix.go_arch }} - - - name: Release artifact - uses: softprops/action-gh-release@v1 - with: - files: ./aws-in-a-box-${{ matrix.go_os }}-${{ matrix.go_arch }} diff --git a/.github/workflows/build_release.sh b/.github/workflows/build_release.sh new file mode 100755 index 0000000..81c8447 --- /dev/null +++ b/.github/workflows/build_release.sh @@ -0,0 +1,15 @@ +set -eux + +for GOOS in "windows" "linux" "darwin"; do + for GOARCH in "amd64" "arm64"; do + CGO_ENABLED=0 go build -ldflags "-w" -trimpath -o "./aws-in-a-box-$GOOS-$GOARCH" + done +done + +# Set by GH actions, see +# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables +TAG=${GITHUB_REF_NAME} +# The prefix is chosen to match what GitHub generates for source archives +PREFIX="aws-in-a-box-${TAG:1}" +ARCHIVE="aws-in-a-box-$TAG.tar.gz" +git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip > "$ARCHIVE" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2642c5b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: release + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + strategy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + + - name: Build + run: .github/workflows/build_release.sh + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: ./aws-in-a-box-* diff --git a/MODULE.bazel b/MODULE.bazel index def6d84..225e00c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "aws-in-a-box", - version = "0.0.37", + version = "0.0.38", compatibility_level = 1, )