# Copyright (c) 2020-2022 Morwenn
# SPDX-License-Identifier: MIT

name: Wiki Deployment

on:
  push:
    branches:
      - master
    paths:
      - 'docs/**'

jobs:
  sync-wiki-files:
    name: Sync Wiki Files

    runs-on: ubuntu-latest

    steps:
      - name: Checkout /docs
        uses: actions/checkout@v2
        with:
          repository: ${{github.repository}}
          path: main

      - name: Checkout wiki
        uses: actions/checkout@v2
        with:
          repository: ${{github.repository}}.wiki
          path: wiki

      - name: Sync wiki files
        run: |
          rsync -avzr --delete --exclude='.git/' "main/docs/" "wiki/"

      - name: Commit changes
        working-directory: wiki
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add .
          git commit -m "Synchronize wiki with docs/"

      - name: Push changes to wiki
        uses: ad-m/github-push-action@master
        with:
          directory: wiki
          repository: ${{github.repository}}.wiki
          branch: master

# Copyright (c) 2020-2022 Morwenn
# SPDX-License-Identifier: MIT

name: Wiki Deployment

on:
  push:
    branches:
      - master
    paths:
      - 'docs/**'

jobs:
  sync-wiki-files:
    name: Sync Wiki Files

    runs-on: ubuntu-latest

    steps:
      - name: Checkout /docs
        uses: actions/checkout@v2
        with:
          repository: ${{github.repository}}
          path: main

      - name: Checkout wiki
        uses: actions/checkout@v2
        with:
          repository: ${{github.repository}}.wiki
          path: wiki

      - name: Sync wiki files
        run: |
          find main/docs -name "*.md" -exec sed -i 's/.md)/)/' {} \;
          find main/docs -name "*.md" -exec sed -i 's/.md#/#/' {} \;
          rsync -avzr --delete --exclude='.git/' "main/docs/" "wiki/"

      - name: Commit changes
        working-directory: wiki
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add .
          git commit -m "Synchronize wiki with docs/"

      - name: Push changes to wiki
        uses: ad-m/github-push-action@master
        with:
          directory: wiki
          repository: ${{github.repository}}.wiki
          branch: master

Replace some characters in doc before uploading to wiki
Replace some characters in doc before uploading to wiki

This is a first step to having a solution that works in GitHub Wiki,
Github repository browsing and Gollum. There is no perfect solution, but
using the relative .md paths works everywhere except on the GitHub wiki.
The simple solution is to get rid of them in the script that uploads the
documentation to the wiki.
