Skip to content

Update OpenAPI UI dependencies #14

Update OpenAPI UI dependencies

Update OpenAPI UI dependencies #14

# Update the dependencies of the OpenAPI UI and rebuild it, then create a pull request with the changes
name: Update OpenAPI UI dependencies
on: workflow_dispatch
jobs:
update-openapi-ui:
name: Update OpenAPI UI Dependencies
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dev/com.ibm.ws.openapi.ui/swagger-ui
steps:
- name: Checkout Open Liberty
uses: actions/checkout@v2
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: ./dev/com.ibm.ws.openapi.ui/swagger-ui/package-lock.json
- name: Update OpenAPI UI dependencies
run: |
npx --yes npm-check-updates -u
npm update
- name: Find new Swagger UI version
run: |
export SWAGGER_UI_VERSION=$(jq -r '.packages."node_modules/swagger-ui".version' package-lock.json)
echo "SWAGGER_UI_VERSION=$SWAGGER_UI_VERSION" >> $GITHUB_ENV
echo "Swagger UI version: $SWAGGER_UI_VERSION"
- name: Copy SCSS from Swagger UI source
run: |
git clone --depth 1 -b v${SWAGGER_UI_VERSION} https://github.com/swagger-api/swagger-ui.git swagger-ui-src
rm src/style/original/*
rm src/style/core/plugins/json-schema-2020-12/components/*
rm src/style/core/plugins/oas31/components/*
cp swagger-ui-src/src/style/* src/style/original
shopt -s globstar
cd swagger-ui-src/src
cp --parents core/**/*.scss ../../src/style
cd ../..
rm -r swagger-ui-src
- name: Build OpenAPI UI
run: npm run build -- --mode=production
- name: Commit and push
if: ${{ env.GITHUB_REF_NAME != 'integration' }}
run: |
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Update Swagger UI TO $SWAGGER_UI_VERSION [auto]"
git push
- name: Create Pull Request
uses: peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672 #3.14.0
id: create-pr
if: ${{ env.GITHUB_REF_NAME == 'integration' }}
with:
branch: update-swagger-ui-${{ env.SWAGGER_UI_VERSION }}
title: Update Swagger UI to ${{ env.SWAGGER_UI_VERSION }}
commit-message: Update Swagger UI to ${{ env.SWAGGER_UI_VERSION }} [auto]
body: Update Swagger UI and its dependencies and rebuild the OpenAPI UI
labels: in:MicroProfile/OpenAPI, team:MicroprofileUK
- name: Created PR information
if: ${{ steps.create-pr.outputs.pull-request-number }}
run: 'echo "Pull Request created: ${{ steps.create-pr.outputs.pull-request-url }}"'