-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
set -eEuo pipefail | ||
set -CeEuo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")"/../.. | ||
trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR | ||
cd -- "$(dirname -- "$0")"/../.. | ||
|
||
bail() { | ||
echo >&2 "error: $*" | ||
printf >&2 'error: %s\n' "$*" | ||
exit 1 | ||
} | ||
|
||
if [[ -z "${CI:-}" ]]; then | ||
bail "this script is intended to call from release workflow on CI" | ||
fi | ||
|
||
git config user.name "Taiki Endo" | ||
git config user.email "[email protected]" | ||
git config user.name 'Taiki Endo' | ||
git config user.email '[email protected]' | ||
|
||
set -x | ||
|
||
has_update='' | ||
for manifest in manifests/*.json; do | ||
git add -N "${manifest}" | ||
if ! git diff --exit-code -- "${manifest}"; then | ||
name=$(basename "${manifest%.*}") | ||
name="${manifest##*/}" | ||
name="${name%.*}" | ||
git stash | ||
old_version=$(jq -r '.latest.version' "${manifest}") | ||
git stash pop | ||
new_version=$(jq -r '.latest.version' "${manifest}") | ||
if [[ "${old_version}" != "${new_version}" ]]; then | ||
# TODO: If there is a line about updating the same tool in the "Unreleased" section, replace it. | ||
msg="Update \`${name}@latest\` to ${new_version}" | ||
sed -i "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md | ||
sed -Ei "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md | ||
git add "${manifest}" CHANGELOG.md | ||
else | ||
msg="Update ${name} manifest" | ||
|
@@ -40,6 +43,6 @@ for manifest in manifests/*.json; do | |
fi | ||
done | ||
|
||
if [[ -n "${has_update:-}" ]] && [[ -n "${GITHUB_OUTPUT:-}" ]]; then | ||
echo "success=false" >>"${GITHUB_OUTPUT}" | ||
if [[ -n "${has_update}" ]] && [[ -n "${GITHUB_OUTPUT:-}" ]]; then | ||
printf 'success=false\n' >>"${GITHUB_OUTPUT}" | ||
fi |
This file contains 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