Commit d6278b9a authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding support for cleaning a doc version

parent 843a23dd
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -137,9 +137,10 @@ pages:
    PAGES_BRANCH: gl-pages
    PAGES_BRANCH: gl-pages
    HTTPS_REMOTE: https://gitlab-ci-token:${MIKE_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
    HTTPS_REMOTE: https://gitlab-ci-token:${MIKE_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
    TAG_NAME: ""
    TAG_NAME: ""
    TMPTAG: "none"


  rules:
  rules:
    - if: ($CLEAN_WEB_PAGES == 'false' || $CLEAN_WEB_PAGES == 'true') && $CI_COMMIT_TAG
    - if: ($CLEAN_WEB_PAGES == 'false' || $CLEAN_WEB_PAGES == 'true') && $TMPTAG ## Replace this by CI_COMMIT_TAG when test finished
      variables:
      variables:
        TAG_NAME: $CI_COMMIT_TAG
        TAG_NAME: $CI_COMMIT_TAG
    - if: ($CLEAN_WEB_PAGES != "false" && $CLEAN_WEB_PAGES != "true") && $CI_PIPELINE_SOURCE == "web"
    - if: ($CLEAN_WEB_PAGES != "false" && $CLEAN_WEB_PAGES != "true") && $CI_PIPELINE_SOURCE == "web"
@@ -197,7 +198,8 @@ pages:
 #   - mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $TAG_NAME latest
 #   - mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $TAG_NAME latest
 #   - mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
 #   - mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
 #   - git checkout $PAGES_BRANCH -- public/
 #   - git checkout $PAGES_BRANCH -- public/
    - ./spec_on_pages.sh toMkdocs.py $MIKE_ACCESS_TOKEN $CI_SERVER_HOST $CI_PROJECT_PATH "$GITLAB_USER_NAME" $GITLAB_USER_EMAIL $CI_COMMIT_SHA $SPEC_NAME $CI_PROJECT_NAME $TAG_NAME
#    - ./spec_on_pages.sh toMkdocs.py $MIKE_ACCESS_TOKEN $CI_SERVER_HOST $CI_PROJECT_PATH "$GITLAB_USER_NAME" $GITLAB_USER_EMAIL $CI_COMMIT_SHA $SPEC_NAME $CI_PROJECT_NAME $TAG_NAME $CLEAN_WEB_PAGES
    - ./spec_on_pages.sh toMkdocs.py $MIKE_ACCESS_TOKEN $CI_SERVER_HOST $CI_PROJECT_PATH "$GITLAB_USER_NAME" $GITLAB_USER_EMAIL $CI_COMMIT_SHA $SPEC_NAME $CI_PROJECT_NAME $TMPTAG $CLEAN_WEB_PAGES
  artifacts:
  artifacts:
    paths:
    paths:
      - public/
      - public/
+28 −6
Original line number Original line Diff line number Diff line
@@ -21,6 +21,8 @@ echo "SPEC_NAME:" $8
echo "CI_PROJECT_NAME:" $9
echo "CI_PROJECT_NAME:" $9
#$TAG_NAME ->10
#$TAG_NAME ->10
echo "TAG_NAME:" ${10}
echo "TAG_NAME:" ${10}
#$CLEAN_WEB_PAGES ->11
echo "CLEAN_WEB_PAGES:" ${11}


#BACKUP=false
#BACKUP=false
PAGES_BRANCH=gl-pages
PAGES_BRANCH=gl-pages
@@ -33,7 +35,7 @@ pip install -q mkdocs-material mike rich mkdocs-rss-plugin
echo "------ Get the previous GitLab Pages content --------"
echo "------ Get the previous GitLab Pages content --------"
git config --global --replace-all user.name "$5"
git config --global --replace-all user.name "$5"
git config --global --replace-all user.email $6
git config --global --replace-all user.email $6
git fetch origin $PAGES_BRANCH && git checkout $PAGES_BRANCH || git checkout -b $PAGES_BRANCH origin/$PAGES_BRANCH || echo "Pages branch not deployed yet."
git fetch origin $PAGES_BRANCH && git checkout -B $PAGES_BRANCH || git checkout -B $PAGES_BRANCH origin/$PAGES_BRANCH || echo "Pages branch not deployed yet."
git checkout $7
git checkout $7


echo "------ Process published baselines --------"
echo "------ Process published baselines --------"
@@ -82,13 +84,33 @@ echo "------ Move to docs folder --------"
mv ${9^^}/ docs/
mv ${9^^}/ docs/
cat _nav.yml >> mkdocs.yml
cat _nav.yml >> mkdocs.yml


## Create download tab if official baseline version
if [[ ${10} == v* ]]; then
    echo "Adding download tab for version ${10}..."
    mkdir -p "docs/download"
    mv "$8_${10}.docx" docs/download
    sed -i 's/PROJECT/'${9^^}'/g' index.md
    sed -i 's/SPEC/'"$8_${10}.docx"'/g' index.md
    sed -i 's/VERSION/'${10}'/g' index.md
    mv index.md docs/download
    echo "  - Download: 'download/index.md'" >> mkdocs.yml
else
    rm docs/index.md
fi
echo "------ Generating site --------"
echo "------ Generating site --------"
if [[ ${11} =~ miguel[0-9]* ]]; then ##change to ^v* when testing finished
    echo "Removing docs version ${11}..."
    mike list
    mike list
mike delete latest --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH
    mike delete --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH ${11}
else
    echo "Generating docs version ${10}..."
    mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u ${10} latest
    mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u ${10} latest
    mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
    mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
git checkout $PAGES_BRANCH -- public/
fi


git checkout -f $PAGES_BRANCH -- public/

ls public/


exit 0
exit 0
+4 −1
Original line number Original line Diff line number Diff line
# Welcome to oneM2M Specifications



![Download baseline for PROJECT version VERSION](SPEC)
+13 −14
Original line number Original line Diff line number Diff line
@@ -336,8 +336,7 @@ def updateNotes(clauses:list[Clause]) -> list[Clause]:
		lines:list[Line] = []
		lines:list[Line] = []
		inNote = False
		inNote = False
		for line in clause.lines:
		for line in clause.lines:
			match line.lineType:
			if line.lineType == LineType.NOTE:
				case LineType.NOTE:
				if not inNote:
				if not inNote:
					lines.append(Line('\n', LineType.TEXT))
					lines.append(Line('\n', LineType.TEXT))
					lines.append(Line('!!! note\n', LineType.NOTE))
					lines.append(Line('!!! note\n', LineType.NOTE))
@@ -345,7 +344,7 @@ def updateNotes(clauses:list[Clause]) -> list[Clause]:
				lines.append(Line(f"\t{re.sub(_matchNoteStart, '', line.text)}", LineType.NOTE))
				lines.append(Line(f"\t{re.sub(_matchNoteStart, '', line.text)}", LineType.NOTE))
				if verbose:
				if verbose:
					print(f'[dim]Converted note in clause "{clause.title}"')
					print(f'[dim]Converted note in clause "{clause.title}"')
				case _:
			else:
				if inNote:
				if inNote:
					lines.append(Line('\n', LineType.TEXT))
					lines.append(Line('\n', LineType.TEXT))
				inNote = False
				inNote = False