2021-10-11 12:40:56 +03:00
|
|
|
name: Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-04-24 16:07:21 +03:00
|
|
|
branches: [main]
|
2021-10-11 12:40:56 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
bundle:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-16 16:16:16 +03:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
2022-01-05 18:11:05 +03:00
|
|
|
- name: Cache node modules
|
2022-05-16 16:16:16 +03:00
|
|
|
uses: actions/cache@v3
|
2022-01-05 18:11:05 +03:00
|
|
|
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-
|
2023-05-18 17:53:26 +03:00
|
|
|
- run: npm ci
|
2022-01-05 18:11:05 +03:00
|
|
|
- run: npm run bundle
|
|
|
|
- name: Store bundle artifact
|
2022-05-16 16:16:16 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-01-05 18:11:05 +03:00
|
|
|
with:
|
|
|
|
name: bundles
|
|
|
|
path: bundles
|
|
|
|
retention-days: 1
|
2021-10-11 12:40:56 +03:00
|
|
|
unit-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-16 16:16:16 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-05-18 17:53:26 +03:00
|
|
|
- run: npm ci
|
2022-01-05 18:11:05 +03:00
|
|
|
- run: npm test
|
2021-10-11 12:40:56 +03:00
|
|
|
e2e-tests:
|
|
|
|
needs: [bundle]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-16 16:16:16 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-05-18 17:53:26 +03:00
|
|
|
- run: npm ci
|
2022-01-05 18:11:05 +03:00
|
|
|
- name: Download bundled artifact
|
2022-05-16 16:16:16 +03:00
|
|
|
uses: actions/download-artifact@v3
|
2022-01-05 18:11:05 +03:00
|
|
|
with:
|
|
|
|
name: bundles
|
|
|
|
path: bundles
|
|
|
|
- run: npm run e2e
|
2024-04-24 16:07:21 +03:00
|
|
|
check-version:
|
|
|
|
name: Check Version
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [bundle, unit-tests, e2e-tests]
|
|
|
|
outputs:
|
|
|
|
changed: ${{ steps.check.outputs.changed }}
|
|
|
|
version: ${{ steps.check.outputs.version }}
|
|
|
|
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/version-check@v2.0.1
|
|
|
|
with:
|
|
|
|
file-url: https://cdn.jsdelivr.net/npm/redoc/package.json
|
|
|
|
static-checking: localIsNew
|
2021-10-11 12:40:56 +03:00
|
|
|
publish:
|
2022-05-30 13:40:19 +03:00
|
|
|
name: Publish to NPM
|
2024-04-24 16:07:21 +03:00
|
|
|
needs: [check-version]
|
2021-10-11 12:40:56 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-05-16 16:16:16 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2021-10-11 12:40:56 +03:00
|
|
|
with:
|
2022-01-05 18:11:05 +03:00
|
|
|
node-version: '14.x'
|
2021-10-11 20:39:20 +03:00
|
|
|
registry-url: 'https://registry.npmjs.org'
|
2022-05-16 16:16:16 +03:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-11 12:40:56 +03:00
|
|
|
- name: Download bundled artifacts
|
2022-05-16 16:16:16 +03:00
|
|
|
uses: actions/download-artifact@v3
|
2021-10-11 12:40:56 +03:00
|
|
|
with:
|
|
|
|
name: bundles
|
|
|
|
path: bundles
|
|
|
|
- name: Cache node modules
|
2022-05-16 16:16:16 +03:00
|
|
|
uses: actions/cache@v3
|
2021-10-11 12:40:56 +03:00
|
|
|
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
|
2021-10-11 18:32:43 +03:00
|
|
|
run: npm ci && npm run declarations
|
2021-10-11 12:40:56 +03:00
|
|
|
- name: Publish to NPM
|
|
|
|
run: npm publish
|
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2022-05-30 13:40:19 +03:00
|
|
|
|
|
|
|
publish-cdn:
|
|
|
|
name: Publish to CDN
|
2024-04-24 16:07:21 +03:00
|
|
|
needs: [check-version]
|
2022-05-30 13:40:19 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Configure AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
|
|
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
|
2022-08-18 16:56:28 +03:00
|
|
|
|
|
|
|
invalidate-cache:
|
|
|
|
name: Clear cache
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-18 17:26:00 +03:00
|
|
|
needs: [publish, publish-cdn]
|
2022-08-18 16:56:28 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Configure AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
|
|
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
|
|
|
|
env:
|
|
|
|
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
|