/
githubmirror
/
sssd
Обзор
Документация
Войти
/
githubmirror
/
sssd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.13.1
scripts/release.sh
125 строк
3 KB
Pavel Březina
ci: automatically generate release notes
14 апр 2026, 13:43
14 апр 2026, 13:43
c8257a3
Код
Авторство
О чём код?
#!/usr/bin/env bash set -e # Group output in Github Job view function GROUP_START() { echo "::group::$1" } function GROUP_END() { echo "::endgroup::" } # Usage if [ "$#" -ne 3 ] && [ "$#" -ne 5 ]; then echo "Usage: $0 <branch> <version> <prev-version> [<github-repo> <git-remote>]" >&2 exit 1 fi tmpdir=$(mktemp -d) scriptdir=`realpath \`dirname "$0"\`` rootdir=`realpath "$scriptdir/.."` branch=$1 version=$2 prev_version=$3 github_repo="${4:-SSSD/sssd}" git_remote="${5:-origin}" echo "SSSD sources location: $rootdir" echo "Repository: $github_repo" echo "Remote: $git_remote" echo "Temporary directory: $tmpdir" echo "Target branch: $branch" echo "Released version: $version" echo "Previous version: $prev_version" # Work in a temporary copy of the repository pushd $tmpdir trap 'rm -rf "$tmpdir"; popd' EXIT cp -a "$rootdir/." "$tmpdir" GROUP_START "Check prerequisites" # Check if required commands are installed for cmd in git gh autoreconf make sed gpg; do if ! command -v "$cmd" &> /dev/null; then echo "Error: Required command '$cmd' is not installed." >&2 exit 1 fi done # Check if there are any opened weblate pull requests if [ -n "$(gh pr list --author weblate --state open --base \"$branch\" --repo \"$github_repo\")" ]; then echo "Error: There are open weblate pull-requests, please merge them first." >&2 exit 1 fi # Check if repository is pristine if [ -n "$(git status --porcelain)" ]; then echo "Error: SSSD sources have uncommitted changes." >&2 exit 1 fi GROUP_END set -x GROUP_START "Checkout branch" git fetch origin "$branch" git checkout "$branch" git pull --rebase GROUP_END GROUP_START "Configure SSSD" autoreconf -if ./configure GROUP_END GROUP_START "Update translations" make update-po git add po/ src/man/po/ git commit -S -m "pot: update pot files" GROUP_END GROUP_START "Commit and tag release" # Set release version (allow empty commit in case it was already set) sed -i -E "s/(.+VERSION_NUMBER.+)\\[.+\\](.+)/\1[$version]\2/" version.m4 git add version.m4 git commit -S -m "Release sssd-$version" --allow-empty git tag -s "$version" -m "Release sssd-$version" GROUP_END GROUP_START "Create tarball" make dist-gzip GROUP_END GROUP_START "Sign tarball" gpg --default-key C13CD07FFB2DB1408E457A3CD3D21B2910CF6759 --detach-sign --armor "sssd-${version}.tar.gz" sha256sum "sssd-${version}.tar.gz" > "sssd-${version}.tar.gz.sha256sum" GROUP_END GROUP_START "Authenticate git commands" gh auth setup-git GROUP_END GROUP_START "Push commits and tag" git push "$git_remote" "$branch" git push "$git_remote" "$version" GROUP_END GROUP_START "Create GitHub release" gh release create "$version" \ --repo "$github_repo" \ --title "sssd-$version" \ --notes "[**See full release notes here.**](https://sssd.io/release-notes/sssd-$version.html)" \ --generate-notes \ --verify-tag \ --draft \ "sssd-${version}.tar.gz" \ "sssd-${version}.tar.gz.asc" \ "sssd-${version}.tar.gz.sha256sum" GROUP_END GROUP_START "Generate release notes" ./scripts/full-release-notes.sh --from "$prev_version" --to HEAD --version "$version" > "/tmp/sssd-$version.rst" echo "Release notes stored at /tmp/sssd-$version.rst" GROUP_END