I have in a file a placeholder GitHash
and want to replace this with the git commit short sha hash and use sed for example.
This should be done in a pipeline job in GitLab.
So I wrote following into my .gitlab-ci.yml
file:
set-revesion:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: Set
script:
- apk update
- apk add zip # Because it is a .odt which needs to be unpacked
- mkdir MyFile
- unzip MyFile.odt -d unpack
- cd unpack
- sed -e 's|GitHash|${$CI_COMMIT_SHORT_SHA}|g' -i content.xml
- sed -e 's|GitHash|${$CI_COMMIT_SHORT_SHA}|g' -i styles.xml
- zip -r ../MyFile/MyFile.odt .
artifacts:
when: always
paths:
- Specification/