forked from eclipse-xpanse/xpanse
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.86 KB
/
upload-swaggerhub-only.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Huawei Inc.
#
---
name: upload-to-swagger-hub-only
# This job generates the API doc for the version requested and uploads it to SwaggerHub.
on:
workflow_dispatch:
inputs:
VersionToBeUploaded:
type: string
description: Enter the version of the API that must be uploaded.Eg., 1.0.1
IsDefaultVersion:
type: boolean
default: false
description: Is the version the new default version.
env:
BOT_USER_NAME: eclipse-xpanse-bot
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
upload-to-swagger-hub:
runs-on: ubuntu-latest
env:
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
SWAGGERHUB_USER: ${{ secrets.SWAGGERHUB_USER }}
if: github.repository == 'eclipse-xpanse/xpanse'
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: v${{github.event.inputs.VersionToBeUploaded}}
- name: Set Up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: Generate API doc
run: mvn verify -DskipTests -Pgenerate-openapi-doc
- name: Install SwaggerHub CLI
run: npm i -g swaggerhub-cli
- name: Create API with the version as default
if: ${{ github.event.inputs.IsDefaultVersion == 'true' }}
run: swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/XpanseRuntimeApi --file runtime/target/openapi.json --visibility=public --published=publish --setdefault
- name: Create API as Non-default
if: ${{ github.event.inputs.IsDefaultVersion== 'false' }}
run: swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/XpanseRuntimeApi --file runtime/target/openapi.json --visibility=public --published=publish