Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(release): github actions to release
next
branch (#8380)
* swagger-ui * swagger-ui-react
- Loading branch information
Showing
4 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" | ||
} | ||
] | ||
] | ||
} |