shithub: rgbds

ref: 8fa5a4255e93fd7a3eeec24e69ae4e90ec7696b4
dir: /.github/workflows/update-master-docs.yml/

View raw version
name: "Update master docs"
on:
  push:
    branches:
      - master
    paths:
      - .github/actions/get-pages.sh
      - src/gbz80.7
      - src/rgbds.5
      - src/rgbds.7
      - src/asm/rgbasm.1
      - src/asm/rgbasm.5
      - src/link/rgblink.1
      - src/link/rgblink.5
      - src/fix/rgbfix.1
      - src/gfx/rgbgfx.1

jobs:
  build:
    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.5.tar.gz'
          tar xf mandoc-1.14.5.tar.gz
          cd mandoc-1.14.5
          ./configure
          make
          sudo make install
      - name: Update pages
        working-directory: rgbds
        run: |
          ./.github/actions/get-pages.sh ../rgbds-www 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 "[email protected]"
          git add .
          git commit -m "Update RGBDS master documentation"
          if git remote | grep -q origin; then
            git remote set-url origin [email protected]:gbdev/rgbds-www.git
          else
            git remote add origin [email protected]:gbdev/rgbds-www.git
          fi
          git push origin master