Files
netbird-docs/.github/workflows/build_n_push.yml
pascal-fischer f33b4df3dd Add workflow for api gen and refactor genration script (#60)
* update gitignore

* add first version of api generation flow

* try to run flow

* testing flow

* update gen flow

* switch flow to macOS

* fix

* add npm install

* test workflow

* Update API pages

* test workflow with current main

* refactor parser

* merge examples and schema functions

* merge examples and schema functions

* merge parameters as well

* revert template to single class component

* update account

* finalizing

* update with the newest version of openapi

* full flow

* update

* add docker command

* split flow in two jobs

* remove testing trigger

---------

Co-authored-by: GitHub Actions <no-reply@github.com>
2023-06-05 09:35:54 +02:00

66 lines
1.8 KiB
YAML

name: docs site build and push
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:
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: netbirdio/docs.netbird.io
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: netbirdio
password: ${{ secrets.DOCKER_TOKEN }}
-
name: Docker build and push
uses: docker/build-push-action@v2
with:
file: docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}