Skip to content

MSEARCH-844: Linked Data Hub index introduced instead of not used LD … #70

MSEARCH-844: Linked Data Hub index introduced instead of not used LD …

MSEARCH-844: Linked Data Hub index introduced instead of not used LD … #70

Workflow file for this run

name: api-doc
# https://dev.folio.org/guides/api-doc/
# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''
env:
API_TYPES: 'OAS'
API_DIRECTORIES: 'target/api/openapi'
API_INPUT_SPEC: 'src/main/resources/swagger.api/mod-search.yaml'
API_EXCLUDES: ''
OUTPUT_DIR: 'folio-api-docs'
AWS_S3_BUCKET: 'foliodocs'
AWS_S3_FOLDER: 'api'
AWS_S3_REGION: 'us-east-1'
AWS_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_S3_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
on:
workflow_dispatch:
push:
branches: [ main, master ]
paths:
- 'src/main/resources/swagger.api/**'
tags: '[vV][0-9]+.[0-9]+.[0-9]+*'
jobs:
api-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.REF }}
submodules: recursive
- name: Build spec
uses: s4u/[email protected]
- run: |
mvn openapi-generator:generate \
-Dopenapi.generator.maven.plugin.inputSpec=${{ env.API_INPUT_SPEC }} \
-Dopenapi.generator.maven.plugin.generatorName=openapi-yaml \
-Dopenapi.generator.maven.plugin.output=target/api
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-doc \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Obtain version if release tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
version=$(echo ${GITHUB_REF#refs/tags/[vV]} | awk -F'.' '{ printf("%d.%d", $1, $2) }')
echo "VERSION_MAJ_MIN=${version}" >> $GITHUB_ENV
- name: Set some vars
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Report some info
run: |
echo "REPO_NAME=${{ env.REPO_NAME }}"
- name: Do api-doc
run: |
if test -n "${{ env.VERSION_MAJ_MIN }}"; then
echo "Docs for release version ${{ env.VERSION_MAJ_MIN }}"
option_release=$(echo "--version ${{ env.VERSION_MAJ_MIN }}")
else
option_release=""
fi
python3 folio-tools/api-doc/api_doc.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
--output ${{ env.OUTPUT_DIR }} $option_release
- name: Show generated files
working-directory: ${{ env.OUTPUT_DIR }}
run: ls -R
- name: Fix dead link
run: jq '.config.oas.files[] |= if . == "${{ env.API_DIRECTORIES }}/openapi.yaml" then "${{ env.API_INPUT_SPEC }}" else . end' */config-doc.json > tmp.json && mv tmp.json */config-doc.json
working-directory: ${{ env.OUTPUT_DIR }}
- name: Publish to AWS S3
uses: sai-sharan/[email protected]
with:
access_key: ${{ env.AWS_S3_ACCESS_KEY_ID }}
secret_access_key: ${{ env.AWS_S3_ACCESS_KEY }}
region: ${{ env.AWS_S3_REGION }}
source: ${{ env.OUTPUT_DIR }}
destination_bucket: ${{ env.AWS_S3_BUCKET }}
destination_prefix: ${{ env.AWS_S3_FOLDER }}
delete: false
quiet: false