mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-16 07:26:35 +00:00
Decouple api generation flow from docker build (#62)
* decouple api generation from docker build * add different PAT
This commit is contained in:
37
.github/workflows/build_n_push.yml
vendored
37
.github/workflows/build_n_push.yml
vendored
@@ -3,46 +3,11 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
generateAPI:
|
||||
description: 'Generates API pages if set'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
jobs:
|
||||
generate_api_pages:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install swagger-codegen
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: brew install swagger-codegen
|
||||
|
||||
- name: Generate api pages for netbird main openapi definition
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: |
|
||||
npm install
|
||||
npm run gen
|
||||
|
||||
- name: Commit and push changes
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: |
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
|
||||
git add -A
|
||||
git commit -m "Update API pages"
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||
git push
|
||||
|
||||
docs_build_n_push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [generate_api_pages]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
|
||||
43
.github/workflows/generate_api_pages.yml
vendored
Normal file
43
.github/workflows/generate_api_pages.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: generate api pages
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Netbird release tag version'
|
||||
required: true
|
||||
default: "refs/tags/vX.Y.Z"
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
generate_api_pages:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Parse tag input
|
||||
id: semver_parser
|
||||
uses: booxmedialtd/ws-action-parse-semver@v1
|
||||
with:
|
||||
input_string: ${{ github.event.inputs.tag }}
|
||||
version_extractor_regex: '\/v(.*)$'
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install swagger-codegen
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: brew install swagger-codegen
|
||||
|
||||
- name: Generate api pages for netbird main openapi definition
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: |
|
||||
swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml -l openapi -o generator/openapi
|
||||
npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources
|
||||
|
||||
- name: Commit and push changes
|
||||
if: ${{ inputs.generateAPI }}
|
||||
run: |
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
|
||||
git add -A
|
||||
git commit -m "Update API pages"
|
||||
git remote set-url origin https://x-access-token:${{ secrets.DEV_GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||
git push
|
||||
Reference in New Issue
Block a user