Update OpenAPI UI dependencies #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/* | |
cp swagger-ui-src/src/style/* src/style/original | |
rm -r swagger-ui-src | |
- name: Build OpenAPI UI | |
run: npm run build -- --mode=production | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672 #3.14.0 | |
id: create-pr | |
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 }}"' |