Skip to content

docapi

docapi #216

Workflow file for this run

name: Run docapi
on:
repository_dispatch:
types: [docapi]
permissions:
contents: write
jobs:
generate:
runs-on: ubuntu-latest
concurrency:
# Ensure that only one job runs at a time, to avoid push conflicts
group: docapi
steps:
- name: Setup variables
id: setup-variables
run: |
REF=${{ github.event.client_payload.ref }}
if [ "$REF" = "refs/heads/main" ]; then
echo "Ref: main"
else
echo "Invalid ref: $REF"
exit 1
fi
- name: Download Vertex
uses: actions/checkout@v4
with:
repository: vertex-center/vertex
ref: ${{ github.event.client_payload.ref }}
path: vertex
- name: Download Vertex-OpenAPI
uses: actions/checkout@v4
with:
repository: vertex-center/openapi
path: openapi
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Generate openapi.yaml
run: |
cd vertex
go run ./cmd/openapi
cd ..
rm -rf openapi/*.yaml
cp -r vertex/openapi/. openapi/
- name: Commit and push changes if needed
run: |
cd openapi
git config user.email "149347004+vertex-nexa[bot]@users.noreply.github.com"
git config user.name "vertex-nexa[bot]"
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit"
else
git add .
git commit -m "Update openapi.*.${{ steps.setup-variables.outputs.PATH }}"
git push
fi
cd ..
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Create tag if needed
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
run: |
cd openapi
REF=${{ github.event.client_payload.ref }}
TAG="${REF#refs/tags/}"
git tag $TAG
git push origin $TAG
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}