31 lines
1.1 KiB
YAML
31 lines
1.1 KiB
YAML
stages:
|
|
- trigger
|
|
|
|
trigger:
|
|
stage: trigger
|
|
image: quay.io/curl/curl:latest
|
|
script:
|
|
# Put the private-token with a colon into a variable to escape the "Linefeed-Limbo" (https://stackoverflow.com/a/51187502)
|
|
- PRIVATE_TOKEN="${PRIVATE_TOKEN}:"
|
|
|
|
# Get the current datetime (in local time with the TZ variable)
|
|
- CURRENT_DATE="$(date +'%F %T')"
|
|
|
|
# Add it to each commit message of the repository (and make sure there is no carriage returns)
|
|
- MESSAGE="${COMMIT_MESSAGE:-$CI_COMMIT_MESSAGE} (${CURRENT_DATE})"
|
|
- MESSAGE=$(echo "${MESSAGE}"|tr -d '\n')
|
|
|
|
# Use the Repository submodules API to update the submodule reference in the repository
|
|
- curl
|
|
--data "branch=${BRANCH:-$CI_DEFAULT_BRANCH}&commit_sha=${COMMIT_SHA:-$CI_COMMIT_SHA}&commit_message=${MESSAGE}"
|
|
--header "${PRIVATE_TOKEN} ${GITLAB_TOKEN}"
|
|
--request PUT
|
|
"${CI_SERVER_URL}/api/v4/projects/${PROJECT_ID}/repository/submodules/${SUBMODULE_PATH}"
|
|
rules:
|
|
- changes:
|
|
- posts/
|
|
variables:
|
|
PROJECT_ID: '8'
|
|
SUBMODULE_PATH: 'content'
|
|
TZ: ':Europe/Paris'
|