github.com/tada-team/tdproto@v1.51.57/.github/workflows/swagger_deploy.yml (about)

     1  ---
     2  name: Download and deploy swagger
     3  
     4  on: [push]
     5  
     6  env:
     7    TDPROTO_DIR: tdproto
     8    CLONE_DIR: clone_dir
     9  
    10  concurrency:
    11    group: ${{ github.workflow }}
    12    cancel-in-progress: false
    13  
    14  jobs:
    15    build:
    16      runs-on: ubuntu-20.04
    17      environment: swagger_deployment
    18      steps:
    19        - uses: actions/checkout@v2
    20          with:
    21            path: ${{ env.TDPROTO_DIR }}
    22        - uses: actions/setup-go@v2
    23          with:
    24            go-version: '1.16'
    25        - name: Clone swagger page repo
    26          uses: actions/checkout@v2
    27          with:
    28            repository: 'tada-team/td-swagger-ui'
    29            ssh-key: ${{ secrets.SWAGGER_DEPLOY_KEY }}
    30            path: ${{ env.CLONE_DIR }}
    31        - name: Clean swagger page repo
    32          continue-on-error: true
    33          working-directory: ${{ env.CLONE_DIR }}
    34          run: |
    35            git rm --cached -r .
    36        - name: Run makefile
    37          run: |
    38            make \
    39              TDPROTO_OPEN_API_DIR="${GITHUB_WORKSPACE}/${TDPROTO_DIR}/codegen/openapi/" \
    40              DESTDIR="${GITHUB_WORKSPACE}/${CLONE_DIR}" \
    41              --file "${GITHUB_WORKSPACE}/${TDPROTO_DIR}/codegen/openapi/Makefile" \
    42              install
    43        - name: Commit and upload swagger
    44          if: github.ref == 'refs/heads/master'
    45          working-directory: ${{ env.CLONE_DIR }}
    46          run: |
    47            git add --all
    48            git config --global user.email "action@github.com"
    49            git config --global user.name "Github Action"
    50            git commit -m "Generate swagger on $(date)" --allow-empty
    51            git push