diff --git a/.github/workflows/release-swagger-ui-react.yml b/.github/workflows/release-swagger-ui-react.yml new file mode 100644 index 00000000..d38c3016 --- /dev/null +++ b/.github/workflows/release-swagger-ui-react.yml @@ -0,0 +1,78 @@ +name: Build & Release SwaggerUI-React@next + +# single-stage +on: + workflow_dispatch: + branches: + - next + +# multi-stage automation +# on: +# workflow_run: +# workflows: ["Release SwaggerUI@next"] +# types: +# - completed +# branches: [next] + +defaults: + run: + working-directory: flavors/swagger-ui-react/release +jobs: + release-swagger-ui-react: + name: Release SwaggerUI React + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + submodules: true + ref: next + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://npm.pkg.github.com/ + scope: "@swagger-api" + + - name: Install dependencies (to create package manifest) + run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + + - name: MKDIR `dist` working directory + run: mkdir -p ../dist + + - name: Copy SwaggerUI dist files to MKDIR + run: | + ls ../dist + cp ../../../dist/swagger-ui-es-bundle-core.js ../dist + cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist + cp ../../../dist/swagger-ui.css ../dist + cp ../../../dist/swagger-ui.css.map ../dist + + - name: Create a releasable package manifest + run: node create-manifest.js > ../dist/package.json + + - name: Transpile our top-level React Component + run: | + ../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js + ../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js + + - name: Copy our README into the dist folder for npm + run: cp ../README.md ../dist + + - name: Copy LICENSE & NOTICE into the dist folder for npm + run: | + cp ../../../LICENSE ../dist + cp ../../../NOTICE ../dist + + - name: Run the release from the dist folder + run: | + cd ../dist + pwd + npm pack . + env: + NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/release-swagger-ui.yml b/.github/workflows/release-swagger-ui.yml new file mode 100644 index 00000000..432f418e --- /dev/null +++ b/.github/workflows/release-swagger-ui.yml @@ -0,0 +1,76 @@ +name: Release SwaggerUI@next + +on: + workflow_dispatch: + branches: + - next + +jobs: + release-swagger-ui: + name: Release SwaggerUI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + submodules: true + ref: next + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://npm.pkg.github.com/ + scope: "@swagger-api" + + - name: Determine the next release version + uses: cycjimmy/semantic-release-action@v3 + with: + dry_run: true + extra_plugins: | + @semantic-release/git + @semantic-release/exec + env: + GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + + - name: Nothing to release + if: ${{ env.NEXT_RELEASE_VERSION == '' }} + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Nothing to release') + + - name: Install dependencies + run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + + - name: Semantic Release + id: semantic + uses: cycjimmy/semantic-release-action@v3 + with: + dry_run: false + extra_plugins: | + @semantic-release/git + env: + GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }} + + - name: Release failed + if: steps.semantic.outputs.new_release_published == 'false' + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Release failed') + + - name: Release published + 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 }} diff --git a/.gitignore b/.gitignore index 912a2036..c9af1adc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ node_modules .vscode .deps_check .DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local .nyc_output npm-debug.log* .eslintcache diff --git a/.releaserc b/.releaserc new file mode 100644 index 00000000..4efddeee --- /dev/null +++ b/.releaserc @@ -0,0 +1,35 @@ +{ + "branches": [ + { + "name": "master" + }, + { + "name": "next", + "channel": "alpha", + "prerelease": "alpha" + } + ], + "tagFormat": "v${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + [ + "@semantic-release/exec", + { + "verifyReleaseCmd": "echo \"NEXT_RELEASE_VERSION=${nextRelease.version}\" >> $GITHUB_ENV" + } + ], + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": [ + "package.json", + "package-lock.json" + ], + "message": "chore(release): cut the ${nextRelease.version} release\n\n${nextRelease.notes}" + } + ] + ] +} \ No newline at end of file