Skip to content

add description about alone metrics and replaced old photo (#114) #127

add description about alone metrics and replaced old photo (#114)

add description about alone metrics and replaced old photo (#114) #127

name: Publish spec version to SwaggerHub
on:
push:
branches:
- master
- release/[0-9]+.[0-9]+.[0-9]+
- feature/*
jobs:
mergespec:
name: Bundle spec files and validate it.
runs-on: ubuntu-22.04
defaults:
run:
working-directory: openapi
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.16.0'
- run: npm install --location=global swagger-cli @openapitools/openapi-generator-cli
- run: make spec
- run: make validate-spec
- name: Save build artifact
uses: actions/upload-artifact@v3
with:
name: specfile
path: openapi/build/openapi.yml
#testspec:
# name: Test generated spec against the Moira API
# runs-on: ubuntu-latest
# needs: mergespec
# strategy:
# matrix:
# python-version: [3.8]
# steps:
# - uses: actions/checkout@v2
# with:
# repository: moira-alert/docker-compose
# - name: Set up docker services
# run: docker-compose up -d
# Checkout again to switch back to `doc` repository
# - uses: actions/checkout@v2
# - name: Download spec file artifact
# uses: actions/download-artifact@v1
# with:
# name: specfile
# path: openapi/build
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install schemathesis and run tests
# run: |
# python -m pip install --upgrade pip
# pip install schemathesis
# cd openapi
# make test-spec
publishspec:
name: Upload generated OpenAPI description
runs-on: ubuntu-22.04
needs: mergespec
defaults:
run:
working-directory: openapi
steps:
- uses: actions/checkout@v3
# - name: Extract branch name on push
# if: github.event_name != 'pull_request'
# run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
- run: mkdir build/
- name: Download spec file artifact
uses: actions/download-artifact@v3
with:
name: specfile
path: openapi/build
- uses: actions/setup-node@v3
- run: npm i --location=global swaggerhub-cli
- run: |
VERSION=`echo ${GITHUB_REF_NAME}| sed 's#[^a-zA-Z0-9_\.\-]#_#g'`
SWAGGERHUB_API_KEY=${{secrets.SWAGGERHUB_TOKEN}} swaggerhub api:create "Moira/moira-alert/${VERSION}" -f ./build/openapi.yml --published=publish --visibility=public