diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml deleted file mode 100644 index 90e3daa99..000000000 --- a/.github/workflows/build-perf.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build Performance - -on: - pull_request: - branches: - - main - paths-ignore: - - demo/docs/** - -jobs: - build-size: - name: Build Size Report - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: "17" - cache: yarn - - uses: preactjs/compressed-size-action@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - build-script: build - clean-script: clean - pattern: "{demo/build/assets/js/*js,demo/build/assets/css/styles*css,demo/.docusaurus/globalData.json,demo/build/index.html,demo/build/docs/index.html,demo/build/docs/installation/index.html}" - strip-hash: '\.([^;]\w{7})\.' - minimum-change-threshold: 30 - compression: none - - build-time: - name: Build Time Perf - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - cache: yarn - - name: Installation - run: yarn - - # Ensure build with a cold cache does not increase too much - - name: Build (cold cache) - run: yarn build - timeout-minutes: 8 - - # Ensure build with a warm cache does not increase too much - - name: Build (warm cache) - run: yarn build - timeout-minutes: 2 - # TODO post a Github comment with build with perf warnings? diff --git a/.github/workflows/canary-release.yml b/.github/workflows/canary-release.yml deleted file mode 100644 index 0c6cf881e..000000000 --- a/.github/workflows/canary-release.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Canary Release - -on: - push: - branches: - - main - paths: - - packages/** - -permissions: - contents: read - -jobs: - publish-canary: - name: Publish Canary - runs-on: ubuntu-latest - if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3 - with: - fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD" - - name: Set up Node - uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3 - with: - node-version: "16" - cache: yarn - - name: Prepare git - run: | - git config --global user.name "Steven Serrata" - git config --global user.email "sserrata@paloaltonetworks.com" - git fetch - git checkout main - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" >> .npmrc - cat .npmrc - echo "npm whoami" - npm whoami - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - name: Installation - run: yarn && yarn build-packages - - name: Publish Canary release - run: | - yarn canary - env: - NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 4a1b1d460..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [main] - -jobs: - analyze: - if: github.repository_owner == 'PaloAltoNetworks' - name: Analyze - runs-on: ubuntu-latest - permissions: - contents: read - security-events: write - - strategy: - fail-fast: true - matrix: - language: ["javascript"] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/combine-dependabot-prs.yml b/.github/workflows/combine-dependabot-prs.yml deleted file mode 100644 index b872ad7c6..000000000 --- a/.github/workflows/combine-dependabot-prs.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: "Combine Dependabot PRs" - -on: - workflow_dispatch: - inputs: - branchPrefix: - description: "Branch prefix to find combinable PRs based on" - required: true - default: "dependabot" - mustBeGreen: - description: "Only combine PRs that are green (status is success)" - required: true - default: "true" - combineBranchName: - description: "Name of the branch to combine PRs into" - required: true - default: "combine-dependabot-prs" - ignoreLabel: - description: "Exclude PRs with this label" - required: true - default: "nocombine" - -jobs: - combine-prs: - if: github.repository_owner == 'PaloAltoNetworks' - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v3 - id: fetch-branch-names - name: Fetch dependabot branches - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', { - owner: context.repo.owner, - repo: context.repo.repo - }); - branches = []; - prs = []; - base_branch = null; - for (const pull of pulls) { - const branch = pull['head']['ref']; - console.log('Pull for branch: ' + branch); - if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) { - console.log('Branch matched: ' + branch); - statusOK = true; - if(${{ github.event.inputs.mustBeGreen }}) { - console.log('Checking green status: ' + branch); - const statuses = await github.paginate('GET /repos/{owner}/{repo}/commits/{ref}/status', { - owner: context.repo.owner, - repo: context.repo.repo, - ref: branch - }); - if(statuses.length > 0) { - const latest_status = statuses[0]['state']; - console.log('Validating status: ' + latest_status); - if(latest_status != 'success') { - console.log('Discarding ' + branch + ' with status ' + latest_status); - statusOK = false; - } - } - } - console.log('Checking labels: ' + branch); - const labels = pull['labels']; - for(const label of labels) { - const labelName = label['name']; - console.log('Checking label: ' + labelName); - if(labelName == '${{ github.event.inputs.ignoreLabel }}') { - console.log('Discarding ' + branch + ' with label ' + labelName); - statusOK = false; - } - } - if (statusOK) { - console.log('Adding branch to array: ' + branch); - branches.push(branch); - prs.push('#' + pull['number'] + ' ' + pull['title']); - base_branch = pull['base']['ref']; - } - } - } - if (branches.length == 0) { - core.setFailed('No PRs/branches matched criteria'); - return; - } - core.setOutput('base-branch', base_branch); - core.setOutput('prs-string', prs.join('\n')); - - combined = branches.join(' ') - console.log('Combined: ' + combined); - return combined - - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Combine dependabot branches - env: - BASE_BRANCH: ${{ steps.fetch-branch-names.outputs.base-branch }} - BRANCHES_TO_COMBINE: ${{ steps.fetch-branch-names.outputs.result }} - COMBINE_BRANCH_NAME: ${{ github.event.inputs.combineBranchName }} - run: | - echo "$BRANCHES_TO_COMBINE" - sourcebranches="${BRANCHES_TO_COMBINE%\"}" - sourcebranches="${sourcebranches#\"}" - - basebranch="${BASE_BRANCH%\"}" - basebranch="${basebranch#\"}" - - git config pull.rebase false - git config user.name github-actions - git config user.email github-actions@github.com - - git branch $COMBINE_BRANCH_NAME $basebranch - git checkout $COMBINE_BRANCH_NAME - git pull origin $sourcebranches --no-edit - git push origin $COMBINE_BRANCH_NAME - - - name: Get token - id: get_token - uses: machine-learning-apps/actions-app-token@master - with: - APP_PEM: ${{ secrets.APP_PEM }} - APP_ID: ${{ secrets.APP_ID }} - - - uses: actions/github-script@v3 - name: Create Combined Pull Request - env: - PRS_STRING: ${{ steps.fetch-branch-names.outputs.prs-string }} - with: - github-token: ${{ steps.get_token.outputs.app_token }} - script: | - const prString = process.env.PRS_STRING; - const body = 'This PR includes the following security updates:\n' + prString; - await github.pulls.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: '🛡️ Security Updates', - head: '${{ github.event.inputs.combineBranchName }}', - base: '${{ steps.fetch-branch-names.outputs.base-branch }}', - body: body - }); diff --git a/.github/workflows/deploy-live.yml b/.github/workflows/deploy-live.yml deleted file mode 100644 index 64b9f9384..000000000 --- a/.github/workflows/deploy-live.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy Live - -on: - push: - branches: [main] - -jobs: - build: - if: github.repository_owner == 'PaloAltoNetworks' - name: Build - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: yarn --prefer-offline - - - name: Build packages - run: yarn build-packages - - - name: Build site - run: yarn build-demo - - - uses: actions/upload-artifact@v2 - with: - name: build-dir - path: demo/build/ - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/download-artifact@v2 - with: - name: build-dir - path: demo/build/ - - - name: Deploy to Firebase - id: deploy_live - uses: FirebaseExtended/action-hosting-deploy@276388dd6c2cde23455b30293105cc866c22282d # v0.6-alpha - with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANDEV }}" - projectId: pandev - channelId: live - target: docusaurus-openapi.tryingpan.dev - env: - FIREBASE_CLI_PREVIEWS: hostingchannels diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml deleted file mode 100644 index 85546abe9..000000000 --- a/.github/workflows/deploy-preview.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: "Deploy Preview" - -on: - pull_request_target: - branches: [main] - -jobs: - analyze: - if: github.repository_owner == 'PaloAltoNetworks' - name: Analyze - runs-on: ubuntu-latest - permissions: - contents: read - security-events: write - - strategy: - fail-fast: true - matrix: - language: ["javascript"] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 - - build: - name: Build - needs: analyze - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: yarn --prefer-offline - - - name: Build packages - run: yarn build-packages - - - name: Build site - run: yarn build-demo - - - uses: actions/upload-artifact@v2 - with: - name: build-dir - path: demo/build/ - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/download-artifact@v2 - with: - name: build-dir - path: demo/build/ - - - name: Deploy to Firebase - id: deploy_preview - uses: FirebaseExtended/action-hosting-deploy@276388dd6c2cde23455b30293105cc866c22282d # v0.6-alpha - with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANDEV }}" - projectId: pandev - expires: 30d - channelId: "pr${{ github.event.number }}" - env: - FIREBASE_CLI_PREVIEWS: hostingchannels diff --git a/.github/workflows/pr-title-check.yaml b/.github/workflows/pr-title-check.yaml deleted file mode 100644 index 1aa1c64f6..000000000 --- a/.github/workflows/pr-title-check.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: PR Title Check - -on: - pull_request: - branches: - - main - types: - - opened - - synchronize - - reopened - - edited - -jobs: - check: - name: Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check - run: npx ts-node --transpile-only scripts/check-pr-title.ts "$PR_TITLE" - env: - PR_TITLE: ${{ github.event.pull_request.title }} diff --git a/.github/workflows/release-package.yaml b/.github/workflows/release-package.yaml new file mode 100644 index 000000000..7f61b9cb8 --- /dev/null +++ b/.github/workflows/release-package.yaml @@ -0,0 +1,30 @@ +name: "NPM Publish Action" + +on: + release: + types: [published] + +jobs: + release: + name: "Publish npm" + runs-on: ubuntu-latest + steps: + - name: "checkout" + uses: actions/checkout@v3 + + - name: "node setup" + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Login to Github's NPM registry + run: printf "@randlabs:registry=https://npm.pkg.github.com \n//npm.pkg.github.com/:_authToken=${{secrets.PUBLISH_TOKEN}}" > .npmrc + + - name: Install all dependencies + run: yarn + + - name: Build libs + run: yarn build-packages + + - name: Publish package + run: cd packages/docusaurus-theme-openapi-docs && npm publish diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index d3c5d94bc..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Release - -on: - push: - branches: - - main - -env: - FORCE_COLOR: true - -jobs: - release: - name: Release - runs-on: ubuntu-latest - if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - uses: actions/setup-node@v2 - with: - node-version: "*" - registry-url: "https://registry.npmjs.org" - - name: Release - run: npx ts-node --transpile-only scripts/publish.ts - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml deleted file mode 100644 index 5f0f1fe13..000000000 --- a/.github/workflows/validate.yaml +++ /dev/null @@ -1,94 +0,0 @@ -name: Validate - -on: - push: - branches: [main] - pull_request: - branches: [main] - -env: - FORCE_COLOR: true - -jobs: - prepare-yarn-cache: - name: Prepare Cache - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: "*" - - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - /home/runner/.cache/Cypress - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - - name: Install - run: yarn install --frozen-lockfile - - lint: - name: Lint - needs: prepare-yarn-cache - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: "*" - - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - - name: Install - run: yarn install - - name: Check format - run: yarn format - - name: Lint - run: yarn lint --max-warnings 0 - - test: - name: Test - needs: prepare-yarn-cache - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: "*" - - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - - name: Install - run: yarn install - - name: Test - run: yarn test - - cypress: - name: Cypress - needs: prepare-yarn-cache - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: "*" - - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - /home/runner/.cache/Cypress - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} - - name: Install - run: yarn install - - name: Build - run: yarn build - - name: Cypress - run: yarn test:cypress diff --git a/.npmrc.template b/.npmrc.template new file mode 100644 index 000000000..5c52fac45 --- /dev/null +++ b/.npmrc.template @@ -0,0 +1,2 @@ +@randlabs:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken= \ No newline at end of file diff --git a/packages/docusaurus-theme-openapi-docs/package.json b/packages/docusaurus-theme-openapi-docs/package.json index 45c6fde46..9f92b025b 100644 --- a/packages/docusaurus-theme-openapi-docs/package.json +++ b/packages/docusaurus-theme-openapi-docs/package.json @@ -1,7 +1,7 @@ { - "name": "docusaurus-theme-openapi-docs", + "name": "@randlabs/docusaurus-theme-openapi-docs", "description": "OpenAPI theme for Docusaurus.", - "version": "1.1.12.randlabs", + "version": "1.1.12.2.2", "license": "MIT", "keywords": [ "openapi",