Skip to content

ci: Fix release publish script #5436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

set -euo pipefail

# Avoid sourcing this script multiple times to guard against when lib.sh
# is used by another sourced script, it can lead to confusing results.
if [[ ${SCRIPTS_LIB_IS_SOURCED:-0} == 1 ]]; then
return
fi
# Do not export to avoid this value being inherited by non-sourced
# scripts.
SCRIPTS_LIB_IS_SOURCED=1

# realpath returns an absolute path to the given relative path. It will fail if
# the parent directory of the path does not exist. Make sure you are in the
# expected directory before running this to avoid errors.
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/check_commit_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"
source "$(dirname "$(dirname "${BASH_SOURCE[0]}")")/lib.sh"

from_ref=${1:-}
to_ref=${2:-}
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/generate_release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"
source "$(dirname "$(dirname "${BASH_SOURCE[0]}")")/lib.sh"

old_version=
new_version=
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh"
source "$(dirname "$(dirname "${BASH_SOURCE[0]}")")/lib.sh"

if [[ "${CI:-}" == "" ]]; then
error "This script must be run in CI"
Expand Down Expand Up @@ -110,7 +110,7 @@ fi
source "$SCRIPT_DIR/release/check_commit_metadata.sh" "$old_tag" "$new_ref"

# Craft the release notes.
release_notes="$(execrelative ./generate_release_notes.sh --old-version "$old_tag" --new-version "$new_tag" --ref "$new_ref")"
release_notes="$(execrelative ./release/generate_release_notes.sh --old-version "$old_tag" --new-version "$new_tag" --ref "$new_ref")"

release_notes_file="$(mktemp)"
echo "$release_notes" >"$release_notes_file"
Expand Down