Skip to content

client-update

client-update #633

Workflow file for this run

name: Build client
on:
# Trigger by updates from other repos.
repository_dispatch:
types: [client-update]
# Allow manual trigger.
workflow_dispatch:
inputs:
sha:
type: string
description: SHA corresponding to the openapi image to build the client from
required: true
jobs:
client:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Remove File
uses: JesseTG/rm@v1.0.0
with:
path: pds/
- name: Docker Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Determine SHA
id: sha
run: |
sha=${{ github.event.client_payload.sha }}
if [ -z ${sha} ]; then
sha=${{ inputs.sha }}
fi
echo "sha=${sha}" >> $GITHUB_OUTPUT
- name: Pull openapi image
id: image
run: |
IMAGE=portworx/pds-api:openapi-dev-${{ steps.sha.outputs.sha }}
docker pull ${IMAGE}
echo "::set-output name=name::${IMAGE}"
- name: Unpack openapi docs
run: |
docker create --name pds-api-openapi ${{ steps.image.outputs.name }} nope
docker cp pds-api-openapi:/swagger.json ./swagger.json
- name: Generate client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: go
generator-tag: v5.4.0
openapi-file: swagger.json
command-args: -o pds/v1alpha1/ --package-name pds
# Skips the push if there are no changes, so it's safe to run repeatedly.
- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
add: 'pds/'
default_author: github_actions
message: 'Update client for `${{ steps.sha.outputs.sha }}`'
commit: --signoff
push: true