Skip to content
Snippets Groups Projects
Commit f20d9fdb authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

Upload .license_template_ci

parent f1a4482e
No related branches found
No related tags found
2 merge requests!476spdlog version upgrade,!472Merge ProcessorLandmarkExternal
Pipeline #16648 passed
.license_header_script:
- cd $CI_PROJECT_DIR
# create 'ci_deps' folder (if not exists)
- mkdir -pv ci_deps
# configure git
- export CI_NEW_BRANCH=ci_processing$RANDOM
- echo creating new temporary branch... $CI_NEW_BRANCH
- git config --global user.email "${CI_EMAIL}"
- git config --global user.name "${CI_USERNAME}"
- git checkout -b $CI_NEW_BRANCH # temporary branch
# download license script
- if [ -f /ci_deps/license_manager.sh ]; then
- echo "File license_manager.sh already exists."
- else
- echo "Downloading file license_manager.sh..."
- wget -P /ci_deps https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/wolf/-/raw/$WOLF_CORE_BRANCH/wolf_scripts/license_manager.sh
- fi
# license headers
- export CURRENT_YEAR=$( date +'%Y' )
- echo "current year:" ${CURRENT_YEAR}
- if [ -f license_header_${CURRENT_YEAR}.txt ]; then
# add license headers to new files
- echo "File license_header_${CURRENT_YEAR}.txt already exists. License headers are assumed to be updated. Adding headers to new files..."
- source /ci_deps/license_manager.sh --add --path=. --config-path=. --exclude=ci_deps
- else
# remove license headers of all files
- source /ci_deps/license_manager.sh --remove --path=. --config-path=. --exclude=ci_deps
# update license header
- export PREV_YEAR=$(( CURRENT_YEAR-1 ))
- echo "Creating new file license_header_${CURRENT_YEAR}.txt..."
- git mv license_header_${PREV_YEAR}.txt license_header_${CURRENT_YEAR}.txt
- sed -i "s/${PREV_YEAR}/${PREV_YEAR},${CURRENT_YEAR}/g" license_header_${CURRENT_YEAR}.txt
# add new license headers to all files
- source /ci_deps/license_manager.sh --add --path=. --config-path=. --exclude=ci_deps
- fi
# push changes (if any)
- if git commit -a -m "[skip ci] license headers added or modified" ; then
- git remote set-url --push origin "ssh://git@gitlab.iri.upc.edu:2202/${CI_PROJECT_PATH}.git"
- git push origin $CI_NEW_BRANCH:${CI_COMMIT_REF_NAME}
- else
- echo "No changes, nothing to commit!"
- fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment