|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# @license |
| 4 | +# Copyright 2026 Google Inc. |
| 5 | +# SPDX-License-Identifier: Apache-2.0 |
| 6 | + |
| 7 | +set -e |
| 8 | + |
| 9 | +# Change directory to the git repository root so the script works from any directory |
| 10 | +cd "$(git rev-parse --show-toplevel)" |
| 11 | + |
| 12 | +# 1. Check requirements |
| 13 | +if ! command -v gh &> /dev/null; then |
| 14 | + echo "Error: 'gh' CLI is required but not installed." >&2 |
| 15 | + echo "Please install it first (e.g. 'brew install gh')." >&2 |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +if ! gh auth status &> /dev/null; then |
| 20 | + echo "Error: You are not authenticated with 'gh' CLI." >&2 |
| 21 | + echo "Please run 'gh auth login' first." >&2 |
| 22 | + exit 1 |
| 23 | +fi |
| 24 | + |
| 25 | +GITHUB_TOKEN=$(gh auth token) |
| 26 | +if [ -z "$GITHUB_TOKEN" ]; then |
| 27 | + echo "Error: Failed to retrieve authentication token from 'gh auth token'." >&2 |
| 28 | + exit 1 |
| 29 | +fi |
| 30 | + |
| 31 | +# 2. Determine repository |
| 32 | +REPO_URL="GoogleChromeLabs/webdriver-bidi-protocol" |
| 33 | + |
| 34 | +echo "Running release-please for $REPO_URL..." |
| 35 | + |
| 36 | +# 3. Run manifest-pr |
| 37 | +echo "Checking and updating release pull request..." |
| 38 | +npx release-please manifest-pr \ |
| 39 | + --token="$GITHUB_TOKEN" \ |
| 40 | + --repo-url="$REPO_URL" \ |
| 41 | + --target-branch="main" \ |
| 42 | + --config-file="release-please-config.json" \ |
| 43 | + --manifest-file=".release-please-manifest.json" \ |
| 44 | + --fork \ |
| 45 | + "$@" |
| 46 | + |
| 47 | +# 4. Run manifest-release |
| 48 | +echo "Checking and creating github release..." |
| 49 | +npx release-please manifest-release \ |
| 50 | + --token="$GITHUB_TOKEN" \ |
| 51 | + --repo-url="$REPO_URL" \ |
| 52 | + --target-branch="main" \ |
| 53 | + --config-file="release-please-config.json" \ |
| 54 | + --manifest-file=".release-please-manifest.json" \ |
| 55 | + "$@" |
| 56 | + |
| 57 | +echo "Release-please run complete!" |
0 commit comments