Merge pull request #6 from 1eedaegon/dependabot/go_modules/google.gol… #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Save openapi.yaml as artifact | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
id-token: write | |
pages: write | |
jobs: | |
save-and-upload-openapi-yaml: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: Start minikube | |
uses: medyagh/setup-minikube@master | |
- name: Generate helm definitions | |
run: make helm | |
- name: Deploy helm | |
run: make helm-deploy | |
- name: Run kubectl proxy | |
run: nohup kubectl proxy & | |
- name: Fetch openapi.yaml | |
run: mkdir -p ./generated ; curl -k localhost:8001/openapi/v2 | yq -P > ./generated/openapi.yaml | |
- name: envsubst openapi.yaml | |
run: > | |
export paths=$(yq '.paths | with_entries(select(.key | test("pipeline")))' ./generated/openapi.yaml | sed 's/^/ /') ; | |
export definitions=$(yq '.definitions | with_entries(select(.key | (test("pipeline") or test("io.k8s.apimachinery"))))' ./generated/openapi.yaml | sed 's/^/ /') ; | |
rm -f ./generated/openapi.yaml ; | |
envsubst < ./generated/openapi.template.yaml > ./generated/openapi.yaml | |
- name: Upload openapi.yaml as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openapi.yaml | |
path: ./generated/openapi.yaml | |
if-no-files-found: error | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
registry-url: 'https://registry.npmjs.org' | |
# TODO: Migrate into matrix | |
- name: Generate typescript-axios sdk using openapi.yaml | |
run: > | |
npx @openapitools/openapi-generator-cli generate | |
-i ./generated/openapi.yaml | |
-o ./generated/sdk/ts-axios-out | |
-g typescript-axios | |
- name: Move sdk definitions into npm package using template | |
run: > | |
mkdir -p ./generated/sdk && | |
rm -rf ./generated/sdk/ts-axios ; | |
cp -r ./template/sdk/ts-axios ./generated/sdk/ts-axios && | |
mv ./generated/sdk/ts-axios-out/* ./generated/sdk/ts-axios-out/.* ./generated/sdk/ts-axios && | |
rmdir ./generated/sdk/ts-axios-out | |
- name: Commit sdk definitions | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
- name: Publish ts-axios sdk into npm | |
run: > | |
cd ./generated/sdk/ts-axios && | |
npm publish --provenance --access public --tag ${{ github.sha }} | |
continue-on-error: true | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Compile redoc static pages | |
run: > | |
mkdir -p ./generated/docs ; | |
mkdir -p ./generated/docs/redoc ; | |
npx --node-options='--max-old-space-size=16384' @redocly/cli build-docs ./generated/openapi.yaml -o ./generated/docs/redoc/index.html | |
- name: Commit redoc static page definitions | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
- name: Upload GitHub Pages artifact | |
uses: actions/[email protected] | |
with: | |
path: ./generated/docs | |
deploy-github-pages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: save-and-upload-openapi-yaml | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |