mirror of
https://github.com/coder/code-server.git
synced 2026-05-09 13:57:26 +02:00
Automatically generate helm/changelog PR
This commit is contained in:
46
ci/build/update-repo.sh
Executable file
46
ci/build/update-repo.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
function update_helm() {
|
||||
local current
|
||||
current=$(yq .version ci/helm-chart/Chart.yaml)
|
||||
local next
|
||||
next=$(semver "$current" -i minor)
|
||||
echo "Bumping version from $current to $next..."
|
||||
sed -i.bak "s/^version: $current\$/version: $next/" ci/helm-chart/Chart.yaml
|
||||
|
||||
echo "Setting app version and image to $version..."
|
||||
sed -i.bak "s/^appVersion: .\+\$/appVersion: $version/" ci/helm-chart/Chart.yaml
|
||||
sed -i.bak "s/^ tag: .\+\$/ tag: '$version'/" ci/helm-chart/values.yaml
|
||||
}
|
||||
|
||||
function update_changelog() {
|
||||
local date
|
||||
date=$(printf '%(%Y-%m-%d)T\n' -1)
|
||||
local link="https://github.com/coder/code-server/releases/tag/v$version"
|
||||
sed -i.bak "s|## Unreleased|## Unreleased\n\n## [$version]($link) - $date|" CHANGELOG.md
|
||||
}
|
||||
|
||||
function main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
local version=${VERSION:-$(git describe --tags)}
|
||||
version="${version#v}"
|
||||
|
||||
declare -a steps
|
||||
|
||||
steps+=(
|
||||
"Update Helm chart" "update_helm"
|
||||
"Update changelog" "update_changelog"
|
||||
)
|
||||
|
||||
run-steps "${steps[@]}"
|
||||
|
||||
# This step is always manual.
|
||||
echo "- [ ] https://github.com/coder/code-server-aur/pulls" >> .cache/checklist
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -2,17 +2,6 @@
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
function quiet() {
|
||||
"$@" >/dev/null
|
||||
}
|
||||
|
||||
function indent() {
|
||||
local count=2
|
||||
local space
|
||||
space=$(printf "%${count}s")
|
||||
sed "s/^/$space| /g"
|
||||
}
|
||||
|
||||
function unapply_patches() {
|
||||
local -i exit_code=0
|
||||
quiet quilt pop -af || exit_code=$?
|
||||
@@ -110,31 +99,6 @@ function update_csp() {
|
||||
fi
|
||||
}
|
||||
|
||||
function run() {
|
||||
local -i failed=0
|
||||
rm -f .cache/checklist
|
||||
while (( $# )) ; do
|
||||
local name=$1 ; shift
|
||||
local fn=$1 ; shift
|
||||
# Only run if an earlier step has not failed.
|
||||
if [[ $failed == 0 ]] ; then
|
||||
echo "$name..."
|
||||
if $fn | indent ; then
|
||||
echo "- [X] $name" >> .cache/checklist
|
||||
else
|
||||
((failed++))
|
||||
fi
|
||||
fi
|
||||
# For all failed steps, write out an empty checkbox.
|
||||
if [[ $failed != 0 ]] ; then
|
||||
echo "- [ ] $name" >> .cache/checklist
|
||||
fi
|
||||
done
|
||||
if [[ $failed != 0 ]] ; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function add_changelog() {
|
||||
local file=CHANGELOG.md
|
||||
if grep --quiet "Code $target_vscode_version" "$file" ; then
|
||||
@@ -181,7 +145,7 @@ function main() {
|
||||
"Add changelog note" "add_changelog"
|
||||
)
|
||||
|
||||
run "${steps[@]}"
|
||||
run-steps "${steps[@]}"
|
||||
|
||||
# This step is always manual.
|
||||
echo "- [ ] Verify changelog" >> .cache/checklist
|
||||
|
||||
36
ci/lib.sh
36
ci/lib.sh
@@ -78,6 +78,42 @@ nodeArch() {
|
||||
echo "$cpu"
|
||||
}
|
||||
|
||||
run-steps() {
|
||||
local -i failed=0
|
||||
rm -f .cache/checklist
|
||||
while (( $# )) ; do
|
||||
local name=$1 ; shift
|
||||
local fn=$1 ; shift
|
||||
# Only run if an earlier step has not failed.
|
||||
if [[ $failed == 0 ]] ; then
|
||||
echo "$name..."
|
||||
if $fn | indent ; then
|
||||
echo "- [X] $name" >> .cache/checklist
|
||||
else
|
||||
((failed++))
|
||||
fi
|
||||
fi
|
||||
# For all failed steps, write out an empty checkbox.
|
||||
if [[ $failed != 0 ]] ; then
|
||||
echo "- [ ] $name" >> .cache/checklist
|
||||
fi
|
||||
done
|
||||
if [[ $failed != 0 ]] ; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
quiet() {
|
||||
"$@" >/dev/null
|
||||
}
|
||||
|
||||
indent() {
|
||||
local count=2
|
||||
local space
|
||||
space=$(printf "%${count}s")
|
||||
sed "s/^/$space| /g"
|
||||
}
|
||||
|
||||
# See gulpfile.reh.ts for available targets.
|
||||
if [[ ! ${VSCODE_TARGET-} ]]; then
|
||||
VSCODE_TARGET="$(nodeOS)-$(nodeArch)"
|
||||
|
||||
Reference in New Issue
Block a user