mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-11 15:10:24 +00:00
Format shell scripts with indent_size = 2 to match scripts in CI config
This commit is contained in:
@@ -6,12 +6,12 @@ trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit w
|
||||
cd -- "$(dirname -- "$0")"/../..
|
||||
|
||||
bail() {
|
||||
printf >&2 'error: %s\n' "$*"
|
||||
exit 1
|
||||
printf >&2 'error: %s\n' "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ -z "${CI:-}" ]]; then
|
||||
bail "this script is intended to call from release workflow on CI"
|
||||
bail "this script is intended to call from release workflow on CI"
|
||||
fi
|
||||
|
||||
git config user.name 'Taiki Endo'
|
||||
@@ -21,28 +21,28 @@ set -x
|
||||
|
||||
has_update=''
|
||||
for manifest in manifests/*.json; do
|
||||
git add -N "${manifest}"
|
||||
if ! git diff --exit-code -- "${manifest}"; then
|
||||
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 -Ei "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md
|
||||
git add "${manifest}" CHANGELOG.md
|
||||
else
|
||||
msg="Update ${name} manifest"
|
||||
git add "${manifest}"
|
||||
fi
|
||||
git commit -m "${msg}"
|
||||
has_update=1
|
||||
git add -N "${manifest}"
|
||||
if ! git diff --exit-code -- "${manifest}"; then
|
||||
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 -Ei "s/^## \\[Unreleased\\]/## [Unreleased]\\n\\n- ${msg}./" CHANGELOG.md
|
||||
git add "${manifest}" CHANGELOG.md
|
||||
else
|
||||
msg="Update ${name} manifest"
|
||||
git add "${manifest}"
|
||||
fi
|
||||
git commit -m "${msg}"
|
||||
has_update=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "${has_update}" ]] && [[ -n "${GITHUB_OUTPUT:-}" ]]; then
|
||||
printf 'success=false\n' >>"${GITHUB_OUTPUT}"
|
||||
printf 'success=false\n' >>"${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user