Unverified Commit fd69de75 authored by Benjamin Parisel's avatar Benjamin Parisel Committed by GitHub
Browse files

feat(docPropagation): Create action to propagate doc (#293)

* Add action (with cron all night)
* Use bash script comes from internal-tools
* Update documentation
* Add important citation in notification
* Use badge in README.adoc
parent 08051c19
name: Propagate documentation
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
propagate-doc-upwards:
runs-on: ubuntu-20.04
steps:
- name: Setup checkout
uses: actions/checkout@v2
with:
path: ./bonita-documentation-site
- name: Setup checkout
uses: actions/checkout@v2
with:
repository: bonitasoft/bonita-doc/
token: ${{ secrets.GH_PAT_TOKEN }}
path: ./bonita-doc
- name: Run propagate doc updward
run: |
cd ./bonita-doc
# allow to keep our changes when merge=ours specified in .gitattributes
git config merge.ours.driver true
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
echo "########################################"
echo "Performing the doc propagation"
echo "########################################"
chmod +x ./../bonita-documentation-site/scripts/propagate_doc_upwards.sh
./.././bonita-documentation-site/scripts/propagate_doc_upwards.sh
- name: Send message to Slack channel
if: failure()
uses: slackapi/slack-github-action@v1.17.0
with:
channel-id: 'CCQGMR4ES'
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":fire: Propagation documentation upwards failed. \n \n @channel *We need someone* ! \n - Add a :fire_extinguisher:if you take the action to resolve the conflicts (only one person is required) \n - Add a :sweat_drops: when it’s done (and eventually a :party_parrot: )"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "More details about the error <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}?check_suite_focus=true| here>"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "_Cela semble toujours impossible jusqu’à ce qu’on le fasse._\n _Mandela_"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
\ No newline at end of file
......@@ -15,7 +15,7 @@ endif::[]
:url-nvm-install: {url-nvm}#installation
image::https://api.netlify.com/api/v1/badges/df65c069-bb52-46d2-8bf0-8e16b6b21482/deploy-status[alt=Netlify Status,link=https://app.netlify.com/sites/documentation-bonita/deploys]
image::https://github.com/bonitasoft/bonita-documentation-site/actions/workflows/propagate-doc-upwards.yml/badge.svg[alt=Propagate documentation,link=https://github.com/bonitasoft/bonita-documentation-site/actions/workflows/propagate-doc-upwards.yml/badge.svg]
This repository lets you generate the Bonita documentation site. It uses {url-antora}[Antora] which processes {url-asciidoc}:[AsciiDoc]
documentation content stored in various Git repositories.
......
......@@ -133,6 +133,14 @@ asciidoc:
page-out-of-support: true
----
[WARNING]
====
Don't forget to update `../src/propagate_doc_upwards.sh`.
More details <<update-merge-doc-upwards, here>>
====
=== Mark version as 'Next-release'
Edit the related antora.yml file of the component version, make the content not searchable, and adding an information message.
......@@ -165,3 +173,30 @@ See https://docs.antora.org/antora/2.3/component-prerelease/ to know how to
* mark a prerelease version
* display beta/rc additionnal information in the version
* impact on default version and version ordering
=== Propagate documentation upwards
An action is available (and is triggered each night) to propagate documentation changes upwards to avoid you to update all branches.
Example: _We want to merge branches 2021.1 into 2021.2, 2021.2 into 2022.1 ..._
To do it, run `Propagate documentation content upwards` action.
[NOTE]
====
* If an error occurs during the propagation, a Slack notification is sending to a channel
* The most common root cause is some conflict to manage manually
====
[[update-merge-doc-upwards]]
==== Update script when adding or removing a version
In `scripts/propagate_doc_upwards.sh`, adapt the `main code` section according to your needs.
```
merge 2021.1 2022.2
means
Propagate changes from 2021.1 branches to 2022.2
```
\ No newline at end of file
#!/bin/bash
testReturnCode() {
COD_RET=$1
if [ ${COD_RET} -ne 0 ]; then
echo -e "\e[31m ERROR ${COD_RET} $2 $NC";
exit ${COD_RET}
fi
}
checkError() {
testReturnCode $1 "$2"
}
merge() {
FROM=$1
INTO=$2
echo "Merging branch '${FROM}' into '${INTO}'"
# fetch all branches
git fetch --all
git checkout ${INTO} && git pull
checkError $? "checking out branch ${INTO}"
git merge --no-commit origin/${FROM}
checkError $? "merging branch ${FROM} into ${INTO}. Please resolve conflicts manually."
# only commit if there is something to commit (otherwise the commit command exits with an error code)
if [ ! -z "$(git status --short)" ]; then
git commit -m "Merge branch '${FROM}' into '${INTO}'"
checkError $? "Committing in ${INTO}"
fi
git push origin ${INTO}
checkError $? "pushing remote branch ${INTO}"
}
############################################ main code #####################################"""
merge "7.11" "2021.1"
merge "2021.1" "2021.2"
merge "2021.2" "2022.1"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment