Create Release #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'The new version to tag, ex: 1.0.5' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| create-release: | |
| runs-on: macos-26 # arm64 image: https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Bazelisk | |
| uses: bazelbuild/setup-bazelisk@v3 | |
| - name: Resolve previous tag | |
| id: tags | |
| run: | | |
| TAG="${{ inputs.tag }}" | |
| git fetch --tags --force | |
| PREVIOUS_TAG="$(git tag --merged HEAD --sort=-v:refname | head -n 1)" | |
| if [[ -z "$PREVIOUS_TAG" ]]; then | |
| echo "No existing tags found; unable to determine previous tag." >&2 | |
| exit 1 | |
| fi | |
| if [[ "$PREVIOUS_TAG" == "$TAG" ]]; then | |
| PREVIOUS_TAG="$(git tag --merged HEAD --sort=-v:refname | sed -n '2p')" | |
| fi | |
| if [[ -z "$PREVIOUS_TAG" ]]; then | |
| echo "Unable to determine previous tag." >&2 | |
| exit 1 | |
| fi | |
| echo "previous_tag=$PREVIOUS_TAG" >> "$GITHUB_OUTPUT" | |
| - name: Build release archive | |
| env: | |
| BUILDBUDDY_RBE_API_KEY: ${{ secrets.BUILDBUDDY_RBE_API_KEY }} | |
| run: | | |
| bazel build \ | |
| --config=cache \ | |
| --remote_header="x-buildbuddy-api-key=${BUILDBUDDY_RBE_API_KEY}" \ | |
| --remote_download_outputs=toplevel \ | |
| //distribution:release | |
| - name: Compute integrity | |
| id: integrity | |
| run: | | |
| OUTPUT_PATH="$(bazel info output_path)" | |
| SHA_PATH="$(find "$OUTPUT_PATH" -type f -path '*/bin/distribution/release.tar.gz.sha256' -print -quit)" | |
| if [[ -z "$SHA_PATH" ]]; then | |
| echo "Missing release.tar.gz.sha256 under $OUTPUT_PATH" >&2 | |
| exit 1 | |
| fi | |
| TAR_PATH="${SHA_PATH%.sha256}" | |
| if [[ ! -f "$TAR_PATH" ]]; then | |
| echo "Missing $TAR_PATH" >&2 | |
| exit 1 | |
| fi | |
| if [[ ! -f "$SHA_PATH" ]]; then | |
| echo "Missing $SHA_PATH" >&2 | |
| exit 1 | |
| fi | |
| INTEGRITY="$(cat "$SHA_PATH" \ | |
| | cut -d ' ' -f 1 \ | |
| | xxd -r -p \ | |
| | openssl base64 -A \ | |
| | sed 's/^/sha256-/')" | |
| echo "integrity=$INTEGRITY" >> "$GITHUB_OUTPUT" | |
| echo "release_tar_path=$TAR_PATH" >> "$GITHUB_OUTPUT" | |
| echo "release_sha_path=$SHA_PATH" >> "$GITHUB_OUTPUT" | |