0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

chore: update website deployment (#4320)

* test

* Update website.yml

* Update website.yml

* test2

* Update package.json

* Update package.json

* Update package.json

* clean up

* Update website.yml

* remove dependency
This commit is contained in:
Juan Picado 2024-03-03 13:49:00 +01:00 committed by GitHub
parent 7034c358d5
commit 8783e3a88a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 132 deletions

View file

@ -2,13 +2,6 @@ name: Verdaccio Website CI
on:
workflow_dispatch:
pull_request:
branches-ignore:
- 'renovate/*'
- 'dependabot/*'
paths:
- 'website/**'
- './.github/workflows/website.yml'
schedule:
- cron: '0 0 * * *'
@ -67,89 +60,16 @@ jobs:
path: website/node_modules/.cache/webpack
key: cache/webpack-${{github.ref}}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: cache/webpack-${{github.ref}}
# Will deploy to production on:
# 1st: When a push occurs on master branch
# 2nd: When we force the worflow dispatch through the UI
- name: Build Production
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
env:
CROWDIN_VERDACCIO_API_KEY: ${{ secrets.CROWDIN_VERDACCIO_API_KEY }}
SENTRY_KEY: ${{ secrets.SENTRY_KEY }}
CONTEXT: production
run: pnpm --filter @verdaccio/website netlify:build:production
- name: 🔥 Deploy Production Netlify
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
uses: semoal/action-netlify-deploy@1a53f098745bf78555d11b436f5ee3af87e6b566
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: './website/build'
# Will deploy to Preview URL, only when a pull request is open with changes on the website
- name: Build Deployment Preview
run: pnpm --filter @verdaccio/website netlify:build
- name: Deploy to Netlify
env:
CONTEXT: deploy-preview
run: pnpm --filter ...@verdaccio/website netlify:build:deployPreview
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: pnpm --filter ...@verdaccio/website netlify:deploy
- name: 🤖 Deploy Preview Netlify
if: github.repository == 'verdaccio/verdaccio'
uses: semoal/action-netlify-deploy@1a53f098745bf78555d11b436f5ee3af87e6b566
id: netlify_preview
with:
draft: true
comment-on-pull-request: true
github-deployment-is-production: false
github-deployment-is-transient: true
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: './website/build'
- name: Audit preview URL with Lighthouse
if: github.repository == 'verdaccio/verdaccio'
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@1b0e7c33270fbba31a18a0fbb1de7cc5256b6d39 # tag=11.4.0
with:
urls: |
${{ steps.netlify_preview.outputs.preview-url }}
uploadArtifacts: true
temporaryPublicStorage: true
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
core.setOutput("comment", comment);
- name: Add comment to PR
if: github.repository == 'verdaccio/verdaccio'
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.issue.number }}
delete: true
header: lighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}

View file

@ -1,23 +1,3 @@
[build]
command = "pnpm build"
publish = "build/"
[build.environment]
NPM_FLAGS="--prefix=/dev/null"
NODE_VERSION = "14"
[context.production]
command = "pnpm netlify:build:production"
[context.deploy-preview]
command = "pnpm netlify:build:deployPreview"
[context.branch-deploy]
command = "pnpm netlify:build:deployPreview"
[[plugins]]
package = "../.netlify/netlify-plugin-pnpm"
[[headers]]
for = "/*"
[headers.values]

View file

@ -2848,13 +2848,13 @@ packages:
resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.6
'@babel/types': 7.23.9
/@babel/helper-member-expression-to-functions@7.23.0:
resolution: {integrity: sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.9
/@babel/helper-module-imports@7.21.4:
resolution: {integrity: sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==}
@ -2939,7 +2939,7 @@ packages:
resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.10
'@babel/types': 7.23.9
/@babel/helper-plugin-utils@7.10.4:
resolution: {integrity: sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==}
@ -3087,7 +3087,7 @@ packages:
dependencies:
'@babel/template': 7.22.15
'@babel/traverse': 7.23.7
'@babel/types': 7.23.6
'@babel/types': 7.23.9
transitivePeerDependencies:
- supports-color
@ -3162,7 +3162,7 @@ packages:
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.23.6
'@babel/types': 7.23.9
/@babel/parser@7.23.9:
resolution: {integrity: sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==}
@ -5359,7 +5359,7 @@ packages:
'@babel/helper-module-imports': 7.22.15
'@babel/helper-plugin-utils': 7.22.5
'@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.0)
'@babel/types': 7.23.6
'@babel/types': 7.23.9
dev: true
/@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.7):
@ -5373,7 +5373,7 @@ packages:
'@babel/helper-module-imports': 7.22.15
'@babel/helper-plugin-utils': 7.22.5
'@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.7)
'@babel/types': 7.23.6
'@babel/types': 7.23.9
/@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.9):
resolution: {integrity: sha512-oKckg2eZFa8771O/5vi7XeTvmM6+O9cxZu+kanTU7tD4sin5nO/G8jGJhq8Hvt2Z0kUoEDRayuZLaUlYl8QuGA==}
@ -6098,7 +6098,7 @@ packages:
dependencies:
'@babel/core': 7.23.0
'@babel/helper-plugin-utils': 7.22.5
'@babel/types': 7.23.6
'@babel/types': 7.23.9
esutils: 2.0.3
dev: true
@ -6109,7 +6109,7 @@ packages:
dependencies:
'@babel/core': 7.23.7
'@babel/helper-plugin-utils': 7.22.5
'@babel/types': 7.23.6
'@babel/types': 7.23.9
esutils: 2.0.3
/@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.23.9):
@ -6361,8 +6361,8 @@ packages:
'@babel/helper-function-name': 7.23.0
'@babel/helper-hoist-variables': 7.22.5
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.23.6
'@babel/types': 7.23.6
'@babel/parser': 7.23.9
'@babel/types': 7.23.9
debug: 4.3.4(supports-color@5.5.0)
globals: 11.12.0
transitivePeerDependencies:
@ -10664,11 +10664,11 @@ packages:
dependencies:
'@babel/core': 7.23.9
'@babel/generator': 7.23.6
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.23.9)
'@babel/preset-env': 7.23.9(@babel/core@7.23.9)
'@babel/traverse': 7.23.7
'@babel/types': 7.23.6
'@babel/types': 7.23.9
'@storybook/csf': 0.0.2--canary.4566f4d.1
'@storybook/mdx1-csf': 0.0.1(@babel/core@7.23.9)
core-js: 3.35.0
@ -10835,9 +10835,9 @@ packages:
resolution: {integrity: sha512-4biZIWWzoWlCarMZmTpqcJNgo/RBesYZwGFbQeXiGYsswuvfWARZnW9RE9aUEMZ4XPn7B1N3EKkWcdcWe/K2tg==}
dependencies:
'@babel/generator': 7.23.6
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@babel/preset-env': 7.23.9(@babel/core@7.23.0)
'@babel/types': 7.23.6
'@babel/types': 7.23.9
'@mdx-js/mdx': 1.6.22
'@types/lodash': 4.14.202
js-string-escape: 1.0.1
@ -10854,9 +10854,9 @@ packages:
resolution: {integrity: sha512-4biZIWWzoWlCarMZmTpqcJNgo/RBesYZwGFbQeXiGYsswuvfWARZnW9RE9aUEMZ4XPn7B1N3EKkWcdcWe/K2tg==}
dependencies:
'@babel/generator': 7.23.6
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@babel/preset-env': 7.23.9(@babel/core@7.23.9)
'@babel/types': 7.23.6
'@babel/types': 7.23.9
'@mdx-js/mdx': 1.6.22
'@types/lodash': 4.14.202
js-string-escape: 1.0.1
@ -11325,7 +11325,7 @@ packages:
resolution: {integrity: sha512-cAaR/CAiZRB8GP32N+1jocovUtvlj0+e65TB50/6Lcime+EA49m/8l+P2ko+XPJ4dw3xaPS3jOL4F2X4KWxoeQ==}
engines: {node: '>=10'}
dependencies:
'@babel/types': 7.23.6
'@babel/types': 7.23.9
dev: false
/@svgr/hast-util-to-babel-ast@6.5.1:
@ -12527,7 +12527,7 @@ packages:
/@vue/compiler-core@3.3.4:
resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==}
dependencies:
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@vue/shared': 3.3.4
estree-walker: 2.0.2
source-map-js: 1.0.2
@ -12543,7 +12543,7 @@ packages:
/@vue/compiler-sfc@3.3.4:
resolution: {integrity: sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==}
dependencies:
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@vue/compiler-core': 3.3.4
'@vue/compiler-dom': 3.3.4
'@vue/compiler-ssr': 3.3.4
@ -12565,7 +12565,7 @@ packages:
/@vue/reactivity-transform@3.3.4:
resolution: {integrity: sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==}
dependencies:
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@vue/compiler-core': 3.3.4
'@vue/shared': 3.3.4
estree-walker: 2.0.2
@ -17809,7 +17809,7 @@ packages:
engines: {node: '>=8.3.0'}
dependencies:
'@babel/traverse': 7.23.7
'@babel/types': 7.23.6
'@babel/types': 7.23.9
c8: 7.13.0
transitivePeerDependencies:
- supports-color
@ -20471,7 +20471,7 @@ packages:
engines: {node: '>=10'}
dependencies:
'@babel/core': 7.23.9
'@babel/parser': 7.23.6
'@babel/parser': 7.23.9
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.0
semver: 7.5.4
@ -20935,7 +20935,7 @@ packages:
'@babel/generator': 7.23.6
'@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.9)
'@babel/plugin-syntax-typescript': 7.22.5(@babel/core@7.23.9)
'@babel/types': 7.23.6
'@babel/types': 7.23.9
'@jest/expect-utils': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3

View file

@ -13,8 +13,8 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"netlify:build:production": "docusaurus write-translations && pnpm -w crowdin:sync && NODE_OPTIONS=--max-old-space-size=8192 docusaurus build",
"netlify:build:deployPreview": "docusaurus write-translations --locale en && docusaurus build --locale en",
"netlify:deploy": "npx netlify-cli deploy --dir=./website/build --prod",
"netlify:build": "docusaurus write-translations && pnpm -w crowdin:sync && NODE_OPTIONS=--max-old-space-size=8192 docusaurus build",
"eslint:check": "eslint src/**/*.tsx",
"eslint:write": "eslint src/**/*.tsx --fix"
},