Release SwaggerEditor #195
Workflow file for this run
This file contains hidden or 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
| name: Release SwaggerEditor | |
| on: | |
| workflow_dispatch: | |
| branches: | |
| - main | |
| inputs: | |
| dryRun: | |
| description: 'run in dry-run mode' | |
| default: false | |
| required: true | |
| type: 'boolean' | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| submodules: true | |
| ref: main | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| - name: Determine the next release version | |
| uses: cycjimmy/semantic-release-action@v6 | |
| with: | |
| semantic_version: v24.2.3 | |
| dry_run: true | |
| branches: | | |
| [ | |
| 'main', | |
| '4.x', | |
| 'fix/add-4.x-branch-to-release-config', | |
| ] | |
| extra_plugins: | | |
| @semantic-release/git | |
| @semantic-release/exec | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Nothing to release | |
| if: ${{ env.NEXT_RELEASE_VERSION == '' && github.event.inputs.dryRun == false }} | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| core.setFailed('Nothing to release') | |
| - name: Install dependencies | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| run: npm ci | |
| - name: Prepare for the Release | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| env: | |
| REACT_APP_VERSION: ${{ env.NEXT_RELEASE_VERSION }} | |
| run: | | |
| npm run lint | |
| npm run test | |
| npm run cy:ci | |
| npm run build:bundle:esm | |
| npm run build:bundle:umd | |
| npm run build:definitions | |
| - name: Semantic Release | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| id: semantic | |
| uses: cycjimmy/semantic-release-action@v6 | |
| with: | |
| dry_run: false | |
| extra_plugins: | | |
| @semantic-release/git | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Release failed | |
| if: ${{ steps.semantic.outputs.new_release_published == 'false' && github.event.inputs.dryRun == false }} | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| core.setFailed('Release failed') | |
| - name: Release published | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| run: | | |
| echo ${{ steps.semantic.outputs.new_release_version }} | |
| echo ${{ steps.semantic.outputs.new_release_major_version }} | |
| echo ${{ steps.semantic.outputs.new_release_minor_version }} | |
| echo ${{ steps.semantic.outputs.new_release_patch_version }} | |
| - name: Prepare released version for uploading | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| shell: bash | |
| run: | | |
| echo ${{ steps.semantic.outputs.new_release_version }} > released-version.txt | |
| - name: Upload released version | |
| if: ${{ github.event.inputs.dryRun == false }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: released-version | |
| path: ./released-version.txt | |
| retention-days: 1 |