shithub: rgbds

ref: c278a361dadead172322198c8e325e8444b8b047
dir: /.github/workflows/create-release-docs.yml/

View raw version
name: "Create release docs"
on:
  release:
    types:
      - released # This avoids triggering on pre-releases

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout rgbds@release
        uses: actions/checkout@v2
        with:
          path: rgbds
      - name: Checkout rgbds-www@master
        uses: actions/checkout@v2
        with:
          repository: ${{ github.repository_owner }}/rgbds-www
          path: rgbds-www
      # `-O toc` was added in 1.14.5, but the repos only have 1.14.4
      - 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: | # The ref appears to be in the format "refs/tags/<version>", so strip that
          ./.github/actions/get-pages.sh -r ../rgbds-www ${GITHUB_REF##*/}
      - name: Push new pages
        working-directory: rgbds-www
        run: |
          mkdir -p -m 700 ~/.ssh
          cat > ~/.ssh/id_ed25519 <<<"${{ secrets.SSH_KEY_SECRET }}"
          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 -A
          git commit -m "Create RGBDS ${GITHUB_REF##*/} documentation"
          if git remote | grep -q origin; then
            git remote set-url origin [email protected]:${{ github.repository_owner }}/rgbds-www.git
          else
            git remote add origin [email protected]:${{ github.repository_owner }}/rgbds-www.git
          fi
          git push origin master