shithub: rgbds

ref: 6a51e39a5c57ef94b108f6c562c2503b9e88668c
dir: /.github/workflows/update-master-docs.yml/

View raw version
name: "Update master docs"
on:
  push:
    branches:
      - master
    paths:
      - man/gbz80.7
      - man/rgbds.5
      - man/rgbds.7
      - man/rgbasm.1
      - man/rgbasm.5
      - man/rgblink.1
      - man/rgblink.5
      - man/rgbfix.1
      - man/rgbgfx.1

jobs:
  build:
    if: github.repository_owner == 'gbdev'
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout rgbds@master
        uses: actions/checkout@v2
        with:
          repository: gbdev/rgbds
          ref: master
          path: rgbds
      - name: Checkout rgbds-www@master
        uses: actions/checkout@v2
        with:
          repository: gbdev/rgbds-www
          ref: master
          path: rgbds-www
      - name: Build and install mandoc + install groff
        run: |
          sudo apt-get -qq update
          sudo apt-get install -yq groff zlib1g-dev
          wget 'http://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz'
          tar xf mandoc-1.14.6.tar.gz
          cd mandoc-1.14.6
          ./configure
          make
          sudo make install
      - name: Update pages
        working-directory: rgbds/man
        run: |
          ../../rgbds-www/maintainer/man_to_html.sh master *
      - name: Push new pages
        working-directory: rgbds-www
        run: |
          mkdir -p -m 700 ~/.ssh
          echo "${{ secrets.SSH_KEY_SECRET }}" > ~/.ssh/id_ed25519
          chmod 0600 ~/.ssh/id_ed25519
          eval $(ssh-agent -s)
          ssh-add ~/.ssh/id_ed25519
          git config --global user.name "GitHub Action"
          git config --global user.email "community@gbdev.io"
          git add -A
          git commit -m "Update RGBDS master documentation"
          if git remote | grep -q origin; then
            git remote set-url origin git@github.com:gbdev/rgbds-www.git
          else
            git remote add origin git@github.com:gbdev/rgbds-www.git
          fi
          git push origin master