Feature/missing fields datamodel (#236) #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
REPO_CONSOLIDATE: "devonfw-guide" | |
BUILD_USER: ${{ secrets.BUILD_USER }} | |
BUILD_USER_PASSWD: ${{ secrets.BUILD_USER_PASSWD }} | |
BUILD_USER_EMAIL: ${{ secrets.BUILD_USER_EMAIL }} | |
on: | |
push: | |
paths: | |
- '**.asciidoc' | |
- '**.md' | |
branches: | |
- master | |
name: Sync Docs | |
jobs: | |
update-wiki: | |
if: ${{github.repository == 'devonfw/solicitor'}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup variables | |
run: | | |
echo "ORG=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV | |
echo "REPO_SOURCE=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
echo "REPO_DEST=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}').wiki" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout ${REPO_SOURCE} Repository | |
run: git clone https://github.com/${ORG}/${REPO_SOURCE}.git ${REPO_SOURCE} | |
- name: Checkout ${REPO_DEST} Repository | |
run: git clone https://github.com/${ORG}/${REPO_DEST}.git ${REPO_DEST} | |
- name: Checkout ${REPO_CONSOLIDATE} Repository | |
run: git clone https://github.com/${ORG}/${REPO_CONSOLIDATE}.git ${REPO_CONSOLIDATE} | |
- name: Copy docs and consolidate links | |
run: | | |
cp -rf ${REPO_SOURCE}/documentation/* ${REPO_DEST}/ | |
cd ${REPO_DEST} | |
grep -lr "link:[a-zA-Z0-9_.-]*.asciidoc.*" .| xargs -r sed -i "s/.asciidoc//g" | |
echo ">" | |
git diff-index --quiet HEAD & git status -s | |
echo "<" | |
git status | |
echo ">" | |
git diff-index --quiet HEAD & git status -s | |
echo "<" | |
echo "TO_BE_CANCELLED=$(if [[ $(git diff-index --quiet HEAD & git status -s) ]]; then echo "false"; else echo "true"; fi)" >> $GITHUB_ENV | |
echo "$TO_BE_CANCELLED" | |
- name: setup git user | |
if: ${{ env.TO_BE_CANCELLED == 'false' }} | |
run: | | |
git config --global user.email ${BUILD_USER_EMAIL} | |
git config --global user.name ${BUILD_USER} | |
- name: Sync Wiki | |
if: ${{ env.TO_BE_CANCELLED == 'false' }} | |
run: | | |
cd ${REPO_DEST} | |
git status | |
git add . | |
git commit -m "${REPO_SOURCE} documentation | GitHub Actions $GITHUB_WORKFLOW $GITHUB_RUN_NUMBER" | |
git remote add origin-wiki "https://${BUILD_USER}:${BUILD_USER_PASSWD}@github.com/${ORG}/${REPO_DEST}.git" | |
git push origin-wiki master | |
- name: Sync devonfw guide | |
if: ${{ env.TO_BE_CANCELLED == 'false' }} | |
run: | | |
cd ${REPO_CONSOLIDATE} | |
if [ ! -d ${REPO_DEST} ]; then git submodule add https://github.com/${ORG}/${REPO_DEST}.git; fi; | |
git submodule init | |
git submodule update --recursive --remote | |
cd ${REPO_DEST} | |
git checkout master | |
git pull | |
cd .. | |
git add . | |
git commit -m "${REPO_SOURCE} documentation | GitHub Actions $GITHUB_WORKFLOW $GITHUB_RUN_NUMBER" | |
git remote add origin-wiki "https://${BUILD_USER}:${BUILD_USER_PASSWD}@github.com/${ORG}/${REPO_CONSOLIDATE}.git" | |
git push origin-wiki master | |
- name: Trigger Update devonfw-guide on success | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.GHA_TOKEN }} | |
repository: devonfw/devonfw-guide | |
event-type: dispatch-update-guide |