name: manpage

on:
  push:
    branches:
      - manpage

jobs:
  manpage:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Download Go modules
        run: go mod download

      - name: Build
        run: |
          cd cmd/soft
          go build -v -tags mango

      - name: Generate man-page
        run: |
          ./cmd/soft/soft > ./cmd/soft/soft.1

      - name: Commit
        uses: stefanzweifel/git-auto-commit-action@v4
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          commit_message: "docs: update man page"
          branch: manpage
          commit_user_name: mango 🤖
          commit_user_email: actions@github.com
          commit_author: mango 🤖 <actions@github.com>
