diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000000..883e4433d1 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "prizmui" + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d523b1dc2e..014b0e0f43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: - main: + pr_build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -17,7 +17,17 @@ jobs: - name: Derive appropriate SHAs for base and head for `nx affected` commands uses: nrwl/nx-set-shas@v2 - - run: npm ci + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts + - run: npx nx workspace-lint - run: npx nx format:check --base=origin/main - run: npx nx clear-cache @@ -25,3 +35,12 @@ jobs: - run: npx nx affected --target=lint --base=origin/main --parallel --max-parallel=3 - run: npx nx affected --target=build --base=origin/main --prod --parallel --max-parallel=3 - run: npx nx affected --target=e2e --base=origin/main --prod --parallel --max-parallel=3 + - name: 'Build doc app for firebase hosting' + run: npx nx build doc + - name: 'Upload to Firebase HOSTING' + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PRIZMUI }}' + expires: 5d + projectId: prizmui diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b4aa662ac0..e0c01b0eff 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,18 @@ jobs: with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' - - run: npm ci + + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts + - run: npx nx clear-cache - run: npx nx affected:build --all --prod --parallel --max-parallel=3 - run: cd dist/libs/components && npm publish --verbose || exit_code=0 diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000000..5c5b20b73d --- /dev/null +++ b/firebase.json @@ -0,0 +1,12 @@ +{ + "hosting": { + "public": "dist/apps/doc", + "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +}