diff options
Diffstat (limited to '.gitlab/scripts/changelog.sh')
-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 |