diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-03-10 06:34:14 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-03-10 06:34:14 +0300 |
commit | 789cbeca36efcd135ec9ccb134d91d9487eeb034 (patch) | |
tree | de5a51c6b5310e1d0e214bdc696fc931c99cc43a /.gitlab | |
parent | a7054c1ef71d0aad7c14d05bff3693c3485a6271 (diff) |
Add changelog generation script
Changelog: other
Diffstat (limited to '.gitlab')
-rwxr-xr-x | .gitlab/scripts/changelog.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/.gitlab/scripts/changelog.sh b/.gitlab/scripts/changelog.sh new file mode 100755 index 00000000..051f3e2d --- /dev/null +++ b/.gitlab/scripts/changelog.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -euo pipefail + +PUBLIC_PROJECT_ID='734943' # gitlab-org/gitlab-pages +SECURITY_PROJECT_ID='15685887' # gitlab-org/security/gitlab-pages + +if [[ "${SECURITY:-'0'}" == '1' ]] +then + PROJECT_ID="$SECURITY_PROJECT_ID" +else + PROJECT_ID="$PUBLIC_PROJECT_ID" +fi + +function generate_changelog() { + curl --header "PRIVATE-TOKEN: $TOKEN" \ + --data "version=$VERSION&branch=$BRANCH" \ + --fail \ + --silent \ + --show-error \ + "https://gitlab.com/api/v4/projects/$PROJECT_ID/repository/changelog" +} + +echo 'Updating changelog on the remote branch...' + +if generate_changelog +then + echo 'Updating local branch...' + git pull origin "$BRANCH" + echo 'The changelog has been updated' +else + echo "Failed to generate the changelog for version $VERSION on branch $BRANCH" + exit 1 +fi |