From 7f060b27e92e46a45899eac070083fdc94c26689 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Tue, 9 Aug 2022 22:39:24 +0800 Subject: [PATCH] ci: Clean up CI workflow for releases. --- .github/workflows/release-template.md | 13 ++++++++ .github/workflows/release.yml | 46 +++++++++++++++++++-------- scip-ruby.md | 5 +++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/release-template.md diff --git a/.github/workflows/release-template.md b/.github/workflows/release-template.md new file mode 100644 index 0000000000..940f05d554 --- /dev/null +++ b/.github/workflows/release-template.md @@ -0,0 +1,13 @@ +Download the binary for your platform using: + +```bash +TAG=TAG_PLACEHOLDER \ +OS="$(uname -s | tr '[:upper:]' '[:lower:]')" \ +RELEASE_URL="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/sourcegraph/scip-ruby/releases/download/$TAG" \ +curl -L "$RELEASE_URL/scip-ruby-$OS-x86_64" -o scip-ruby && \ +chmod +x scip-ruby +``` + +NOTE: The `-debug*` binaries are meant for debugging issues +(for example, if you run into a crash with `scip-ruby`), +and are not recommended for general use. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a82a1881c..490c2252ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,10 @@ jobs: run: | TAG="${GITHUB_REF/refs\/tags\//}" TITLE="$(echo "$TAG" | sed 's/-v/ v/')" - gh release create "$TAG" --title "$TITLE" + cat .github/workflows/release-template.md \ + | sed -e "s/TAG_PLACEHOLDER/$TAG/" \ + > notes + gh release create "$TAG" --title "$TITLE" --notes-file notes env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -30,12 +33,25 @@ jobs: TAG: ${{ github.event.ref }} steps: - uses: actions/checkout@v3 - - name: Install Bazel - run: | - if ! which bazelisk; then - sudo npm install --location=global @bazel/bazelisk - fi - - name: Identify OS + - name: "⚙️ Setup Bazel" + run: .github/workflows/setup-bazel.sh + - name: "🚀 Mount Bazel build cache" + uses: actions/cache@v3 + with: + path: ~/bazelcache/build + key: bazel-build-${{ runner.os }} + restore-keys: | + bazel-build-${{ runner.os }} + bazel-build- + - name: "🚀 Mount Bazel repo cache" + uses: actions/cache@v3 + with: + path: ~/bazelcache/repos + key: bazel-repos-${{ runner.os }} + restore-keys: | + bazel-repos-${{ runner.os }} + bazel-repos- + - name: "🔎 Identify OS" run: | case "$(uname -s)" in Linux*) os="linux";; @@ -43,9 +59,11 @@ jobs: *) echo "Unhandled OS type" && exit 1;; esac echo "OS=$os" >> "$GITHUB_ENV" - - name: Run debug build - run: bazel build //main:scip-ruby --config=dbg - - name: Upload debug binary + - name: "🏗 Build (debug)" + run: ./bazel build //main:scip-ruby --config=dbg --explain log --verbose_explanations + - name: "🪵 Print log" + run: cat log && rm log + - name: "📦 Upload debug binary" run: | ls bazel-out debugBinaryPath="scip-ruby-debug-$OS-$(uname -m)" @@ -55,9 +73,11 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} OS: ${{ env.OS }} - - name: Run release build - run: bazel build //main:scip-ruby - - name: Upload release binary + - name: "🏗 Build (release)" + run: bazel build //main:scip-ruby --explain log --verbose_explanations + - name: "🪵 Print log" + run: cat log && rm log + - name: "📦 Upload release binary" run: | ls bazel-out releaseBinaryPath="scip-ruby-$OS-$(uname -m)" diff --git a/scip-ruby.md b/scip-ruby.md index 5c5d806a41..cb637d0539 100644 --- a/scip-ruby.md +++ b/scip-ruby.md @@ -148,3 +148,8 @@ gh pr create -R sourcegraph/scip-ruby ``` This will correctly use the `scip-ruby/master` branch as the target. + +## Cutting a release + +Push a tag of the form `scip-ruby-v*` to `scip-ruby/master`. +See the [release workflow](/.github/workflows/release.yml) for details.