From f6a649613cb8f76fc43398285c188b41f05772f6 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Sat, 8 Apr 2023 09:16:54 -0700 Subject: [PATCH] chore: update release.yaml script to use release archive --- .github/workflows/release.yml | 31 +++---------------- .../{workspace_snippet.sh => release_prep.sh} | 9 ++++-- 2 files changed, 10 insertions(+), 30 deletions(-) rename .github/workflows/{workspace_snippet.sh => release_prep.sh} (60%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0acd7ad..acd4189 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,30 +9,7 @@ on: - "v*.*.*" jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Mount bazel caches - uses: actions/cache@v3 - with: - path: | - "~/.cache/bazel" - "~/.cache/bazel-repo" - key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }} - restore-keys: bazel-cache- - - name: bazel test //... - env: - # Bazelisk will download bazel to here - XDG_CACHE_HOME: ~/.cache/bazel-repo - run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... - - name: Prepare workspace snippet - run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt - - name: Release - uses: softprops/action-gh-release@v1 - with: - prerelease: true - # Use GH feature to populate the changelog automatically - generate_release_notes: true - body_path: release_notes.txt + release: + uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v2 + with: + release_files: rules_cypress-*.tar.gz diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/release_prep.sh similarity index 60% rename from .github/workflows/workspace_snippet.sh rename to .github/workflows/release_prep.sh index a1b2962..99e4635 100755 --- a/.github/workflows/workspace_snippet.sh +++ b/.github/workflows/release_prep.sh @@ -5,8 +5,11 @@ set -o errexit -o nounset -o pipefail # 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="rules_cypress-${TAG:1}" -SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') +ARCHIVE="rules_cypress-$TAG.tar.gz" +git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE +SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') cat << EOF WORKSPACE snippet: @@ -16,9 +19,9 @@ http_archive( name = "aspect_rules_cypress", sha256 = "${SHA}", strip_prefix = "${PREFIX}", - url = "https://github.com/aspect-build/rules_cypress/archive/refs/tags/${TAG}.tar.gz", + url = "https://github.com/aspect-build/rules_cypress/releases/download/${TAG}/${ARCHIVE}", ) EOF awk 'f;/--SNIP--/{f=1}' e2e/workspace/WORKSPACE -echo "\`\`\`" +echo "\`\`\`"