forked from Redocly/redoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Bandwidth/redoc into sync-r…
…ebase
- Loading branch information
Showing
12 changed files
with
301 additions
and
124 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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
name: Publish Package to NPM on Release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
bundle: | ||
|
@@ -23,8 +24,13 @@ jobs: | |
restore-keys: | | ||
npm-${{ hashFiles('package-lock.json') }} | ||
npm- | ||
- run: npm ci | ||
- run: npm run bundle | ||
- name: Clean Install | ||
run: npm ci | ||
|
||
- name: Bundle | ||
run: npm run bundle | ||
|
||
- name: Store bundle artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -36,43 +42,38 @@ jobs: | |
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: npm ci | ||
- run: npm test | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Clean Install | ||
run: npm ci | ||
|
||
- name: Unit Test | ||
run: npm test | ||
|
||
e2e-tests: | ||
name: E2E Tests | ||
needs: [bundle] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: npm ci | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Clean Install | ||
run: npm ci | ||
|
||
- name: Download bundled artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: bundles | ||
path: bundles | ||
- run: npm run e2e | ||
check-version: | ||
name: Check Version | ||
runs-on: ubuntu-latest | ||
needs: [bundle, unit-tests, e2e-tests] | ||
outputs: | ||
changed: ${{ steps.check.outputs.changed }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
- name: Check if version has been updated | ||
id: check | ||
uses: EndBug/[email protected] | ||
with: | ||
file-url: https://cdn.jsdelivr.net/npm/redoc/package.json | ||
static-checking: localIsNew | ||
|
||
- name: E2E Test | ||
run: npm run e2e | ||
|
||
publish: | ||
name: Publish to NPM | ||
needs: [check-version] | ||
if: needs.check-version.outputs.changed == 'true' | ||
name: Publish | ||
needs: [unit-tests, e2e-tests] | ||
runs-on: ubuntu-latest | ||
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }} | ||
steps: | ||
|
@@ -105,41 +106,72 @@ jobs: | |
- name: Before deploy | ||
run: npm ci && npm run declarations | ||
|
||
publish-cdn: | ||
name: Publish to CDN | ||
needs: [check-version] | ||
if: needs.check-version.outputs.changed == 'true' | ||
- name: Publish npm Package | ||
run: | | ||
npm version $RELEASE_VERSION --no-git-tag-version | ||
npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
publish-beta: | ||
name: Publish Beta to NPM | ||
needs: [unit-tests, e2e-tests] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.release.prerelease }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Configure AWS | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
- name: Check Branch Name Format | ||
run: | | ||
re=v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+ | ||
if ! [[ ${{ github.event.release.target_commitish }} =~ $re ]]; then | ||
echo "Target branch does not match expected regex pattern for beta releases ($re)." | ||
echo "${{ github.event.release.target_commitish }}" | ||
echo "Please update your branch name to match the expected regex pattern." | ||
exit 1 | ||
fi | ||
- name: Set Release Version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV | ||
|
||
- name: Check Release Version Format | ||
run: | | ||
re=[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+ | ||
if ! [[ $RELEASE_VERSION =~ $re ]]; then | ||
echo "Tag does not match expected regex pattern for beta releases (v$re)." | ||
echo $RELEASE_VERSION | ||
echo "Please update your tag to match the expected regex pattern." | ||
exit 1 | ||
fi | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
- name: Download all artifact | ||
uses: actions/download-artifact@v3 | ||
- name: Publish to S3 | ||
run: npm run publish-cdn | ||
|
||
invalidate-cache: | ||
name: Clear cache | ||
runs-on: ubuntu-latest | ||
needs: [check-version, publish, publish-cdn] | ||
if: needs.check-version.outputs.changed == 'true' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Configure AWS | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download bundled artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
- name: Invalidate cache | ||
run: ./scripts/invalidate-cache.sh | ||
shell: bash | ||
name: bundles | ||
path: bundles | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
npm-${{ hashFiles('package-lock.json') }} | ||
npm- | ||
- name: Before deploy | ||
run: npm ci && npm run declarations | ||
|
||
- name: Publish npm Package | ||
run: | | ||
npm version $RELEASE_VERSION --no-git-tag-version | ||
npm publish --access public --tag beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.