2021-07-27 14:52:49 -05:00
|
|
|
name: Verdaccio Website CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-10-16 07:06:07 -05:00
|
|
|
|
2022-11-12 01:42:01 -05:00
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
|
2024-08-06 12:31:37 -05:00
|
|
|
concurrency:
|
|
|
|
group: website-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-07-27 14:52:49 -05:00
|
|
|
jobs:
|
|
|
|
build:
|
2022-11-12 01:42:01 -05:00
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
deployments: write
|
|
|
|
pull-requests: write # to comment on pull-requests
|
|
|
|
|
2021-07-27 14:52:49 -05:00
|
|
|
runs-on: ubuntu-latest
|
2024-04-28 04:52:38 -05:00
|
|
|
if: github.repository == 'verdaccio/verdaccio'
|
2023-11-29 14:08:23 -05:00
|
|
|
name: setup verdaccio
|
|
|
|
services:
|
|
|
|
verdaccio:
|
|
|
|
image: verdaccio/verdaccio:5
|
|
|
|
ports:
|
|
|
|
- 4873:4873
|
|
|
|
env:
|
2024-08-06 12:31:37 -05:00
|
|
|
NODE_ENV: production
|
2021-07-27 16:30:02 -05:00
|
|
|
env:
|
|
|
|
NODE_OPTIONS: --max_old_space_size=4096
|
2021-07-27 14:52:49 -05:00
|
|
|
steps:
|
2024-10-03 04:09:46 -05:00
|
|
|
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v3
|
2021-07-27 14:52:49 -05:00
|
|
|
|
2023-11-29 14:00:58 -05:00
|
|
|
- name: Node
|
2024-10-01 15:22:01 -05:00
|
|
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v3
|
2021-07-27 14:52:49 -05:00
|
|
|
with:
|
2023-11-29 14:00:58 -05:00
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Install pnpm
|
|
|
|
run: |
|
|
|
|
corepack enable
|
|
|
|
corepack install
|
2023-11-29 14:06:23 -05:00
|
|
|
- name: set store
|
|
|
|
run: |
|
|
|
|
mkdir ~/.pnpm-store
|
|
|
|
pnpm config set store-dir ~/.pnpm-store
|
2023-11-29 14:02:58 -05:00
|
|
|
- name: Install
|
|
|
|
run: pnpm install --registry http://localhost:4873
|
|
|
|
- name: Cache .pnpm-store
|
2024-08-03 03:32:21 -05:00
|
|
|
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2023-11-29 14:02:58 -05:00
|
|
|
with:
|
|
|
|
path: ~/.pnpm-store
|
|
|
|
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
|
|
restore-keys: |
|
2024-08-06 12:31:37 -05:00
|
|
|
pnpm-
|
|
|
|
- name: Build
|
2022-10-10 01:00:09 -05:00
|
|
|
run: pnpm build
|
2022-10-01 07:08:40 -05:00
|
|
|
- name: Build Translations percentage
|
2023-04-12 10:55:39 -05:00
|
|
|
run: pnpm --filter @verdaccio/crowdin-translations build
|
2021-07-27 14:52:49 -05:00
|
|
|
- name: Cache Docusaurus Build
|
2024-08-03 03:32:21 -05:00
|
|
|
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2021-07-27 14:52:49 -05:00
|
|
|
with:
|
|
|
|
path: website/node_modules/.cache/webpack
|
|
|
|
key: cache/webpack-${{github.ref}}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
restore-keys: cache/webpack-${{github.ref}}
|
|
|
|
- name: Build Production
|
2024-03-03 07:49:00 -05:00
|
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
|
2021-07-27 14:52:49 -05:00
|
|
|
env:
|
2021-07-27 15:39:24 -05:00
|
|
|
CROWDIN_VERDACCIO_API_KEY: ${{ secrets.CROWDIN_VERDACCIO_API_KEY }}
|
2022-10-01 07:08:40 -05:00
|
|
|
SENTRY_KEY: ${{ secrets.SENTRY_KEY }}
|
2021-07-27 14:52:49 -05:00
|
|
|
CONTEXT: production
|
2024-03-03 07:49:00 -05:00
|
|
|
run: pnpm --filter @verdaccio/website netlify:build
|
|
|
|
- name: Deploy to Netlify
|
2024-05-05 09:53:28 -05:00
|
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
|
2021-07-27 14:52:49 -05:00
|
|
|
env:
|
2024-03-03 07:49:00 -05:00
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
2024-08-06 12:31:37 -05:00
|
|
|
run: pnpm --filter ...@verdaccio/website netlify:deploy
|
2021-07-27 14:52:49 -05:00
|
|
|
|