diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e685fbd7a1cc7541554ef83d91091bf57302fc7c..758f2777d74fbf024fe4f67050a0a8a685d51824 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,19 +72,20 @@ deploy: - *doc-workspace-do - git clone https://user:$OHOS_AGGREGATED_DOCS_TOKEN@git.ostc-eu.org/OSTC/infrastructure/openharmony-readthedocs-aggregated.git - cd openharmony-readthedocs-aggregated - - git checkout test # TODO: switch to main / master - - find . -name '*.rst' -delete || true - - tar -c --dereference -C ../experimental . | tar -x - # Clean up files we don't want in the aggregated view - - rm -f .rst-aggregator Makefile + - git checkout origin/main # only main for now - needs to match the rules + - find . -maxdepth 1 -not -path ./.git -not -path . -exec rm -rf {} \; + - tar -c --dereference -C .. --exclude openharmony-readthedocs-aggregated --exclude ./.git . | tar -x # Commit and push back, if something changed. - - git config --local user.name "OpenHarmony Docs Build System" - - git config --local user.email "nobody@example.org" - - git add . - | - if ! git status; then - git commit -sm "Automatic snapshot update"; - git push origin test; - fi + if [ -n "$(git status -s)" ]; then + msg="docs repository snapshot - $CI_COMMIT_BRANCH:$CI_COMMIT_SHA"; + git config --local user.name "OpenHarmony CI"; + git config --local user.email "ci@ostc-eu.org"; + git add -A + git commit -sm "$msg"; + git push origin HEAD:main; + else + echo "Nothing new to commit."; + fi rules: - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == "main"'