From 5cc4fbdb84a931071ab17507c936853b86d777ce Mon Sep 17 00:00:00 2001 From: teds-lin Date: Thu, 18 Apr 2024 23:40:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BD=88=E7=BD=B2Swagger=E8=87=B3=20Github=20Page=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update-swagger.yml | 54 ---------------------------- 1 file changed, 54 deletions(-) delete mode 100644 .github/workflows/update-swagger.yml diff --git a/.github/workflows/update-swagger.yml b/.github/workflows/update-swagger.yml deleted file mode 100644 index 601a0b0..0000000 --- a/.github/workflows/update-swagger.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Update Swagger UI -on: - schedule: - - cron: '0 10 * * *' - workflow_dispatch: - -jobs: - updateSwagger: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Get Latest Swagger UI Release - id: swagger-ui - run: | - release_tag=$(curl -sL https://api.github.com/repos/swagger-api/swagger-ui/releases/latest | jq -r ".tag_name") - echo "release_tag=$release_tag" >> $GITHUB_OUTPUT - current_tag=$(> $GITHUB_OUTPUT - - name: Update Swagger UI - if: steps.swagger-ui.outputs.current_tag != steps.swagger-ui.outputs.release_tag - env: - RELEASE_TAG: ${{ steps.swagger-ui.outputs.release_tag }} - SWAGGER_YAML: "swagger.yaml" - run: | - # Delete the dist directory and index.html - rm -fr dist index.html - # Download the release - curl -sL -o $RELEASE_TAG https://api.github.com/repos/swagger-api/swagger-ui/tarball/$RELEASE_TAG - # Extract the dist directory - tar -xzf $RELEASE_TAG --strip-components=1 $(tar -tzf $RELEASE_TAG | head -1 | cut -f1 -d"/")/dist - rm $RELEASE_TAG - # Move index.html to the root - mv dist/index.html . - # Fix references in dist/swagger-initializer and index.html - sed -i "s|https://petstore.swagger.io/v2/swagger.json|$SWAGGER_YAML|g" dist/swagger-initializer.js - sed -i "s|href=\"./|href=\"dist/|g" index.html - sed -i "s|src=\"./|src=\"dist/|g" index.html - sed -i "s|href=\"index|href=\"dist/index|g" index.html - # Update current release - echo ${{ steps.swagger-ui.outputs.release_tag }} > swagger-ui.version - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - commit-message: Update swagger-ui to ${{ steps.swagger-ui.outputs.release_tag }} - title: Update SwaggerUI to ${{ steps.swagger-ui.outputs.release_tag }} - body: | - Updates [swagger-ui][1] to ${{ steps.swagger-ui.outputs.release_tag }} - - Auto-generated by [create-pull-request][2] - - [1]: https://github.com/swagger-api/swagger-ui - [2]: https://github.com/peter-evans/create-pull-request - labels: dependencies, automated pr - branch: swagger-ui-updates