Skip to content

Fix duplicate rendering and global leakage in the CDN bundle (21.2.0) #1849

Fix duplicate rendering and global leakage in the CDN bundle (21.2.0)

Fix duplicate rendering and global leakage in the CDN bundle (21.2.0) #1849

Workflow file for this run

# Copyright Laserfiche.
# Licensed under the MIT License. See LICENSE in the project root for license information.
name: lf-ui-components-CI
on:
push:
branches: ['\d+.x']
pull_request:
branches: ['\d+.x']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
NPM_VERSION: "21.1.3"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
checks: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
# Only this job's coverage report comments on the PR. A job-level block replaces the workflow's,
# so it repeats the workflow scopes and keeps pull-requests: write away from the publish jobs.
permissions:
contents: write
pages: write
id-token: write
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
- name: Echo build number
run: echo ${{github.run_id}}
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- name: npm ci
run: npm ci
- name: npm run format:check
run: npm run format:check
- name: npm run lint
run: npm run lint
- name: npm run build-ui-components-prod
run: npm run build-ui-components-prod
- name: npm run create-types-lf-ui-components
run: npm run create-types-lf-ui-components
# Also builds the CDN bundle (create-lf-cdn) that the documentation's live demo loads.
- name: npm run build-lf-documentation-prod
run: npm run build-lf-documentation-prod
- name: npm run sass-lf
run: npm run sass-lf
- name: npm run sass-ms
run: npm run sass-ms
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: npm run test:coverage
run: npm run test:coverage
- name: Test Report
uses: dorny/test-reporter@v3
if: always()
with:
name: Jest Test Results
path: ./test-results.xml
reporter: java-junit
only-summary: "true"
use-actions-summary: "true"
fail-on-error: "false"
# Writes the coverage summary to the job summary and, for PRs from this repository, a PR comment.
# PRs from forks get a read-only token, so commenting is skipped for them.
- name: Coverage Report
uses: davelosert/vitest-coverage-report-action@v2
if: ${{ !cancelled() && hashFiles('coverage/coverage-summary.json') != '' }}
with:
name: Unit Test Coverage
json-summary-path: ./coverage/coverage-summary.json
json-final-path: ./coverage/coverage-final.json
comment-on: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'pr' || 'none' }}
- name: Upload Coverage Report
uses: actions/upload-artifact@v7
if: ${{ !cancelled() && hashFiles('coverage/index.html') != '' }}
with:
name: coverage-report
path: ./coverage
# Runs the element build in a browser, which the component unit tests cannot do: they never
# register a custom element. Must stay ahead of the step that moves the bundle out of
# ./dist/lf-cdn/browser.
- name: npm run verify-cdn-demo
run: npm run verify-cdn-demo
- name: "create folder ./dist/ui-components/cdn"
run: "mkdir -p ./dist/ui-components/cdn"
- name: "Copy indigo-pink to ui-components/cdn"
run: cp ./node_modules/@angular/material/prebuilt-themes/indigo-pink.css ./dist/ui-components/cdn
- name: "Move lf-ui-components.js to ui-components/cdn"
run: |
mv lf-ui-components.js lf-ui-components.js.map ../../ui-components/cdn
working-directory: ./dist/lf-cdn/browser
- name: "Append flatpickr.min.css to lf-laserfiche-lite.css"
run: |
echo "/*" >> ./dist/lf-documentation/browser/lf-laserfiche-lite.css
cat LICENSE >> ./dist/lf-documentation/browser/lf-laserfiche-lite.css
echo "The following styles are copied from flatpickr.min.css */" >> ./dist/lf-documentation/browser/lf-laserfiche-lite.css
cat ./node_modules/flatpickr/dist/flatpickr.min.css >> ./dist/lf-documentation/browser/lf-laserfiche-lite.css
- name: "Append flatpickr.min.css to lf-ms-office-lite.css"
run: |
echo "/*" >> ./dist/lf-documentation/browser/lf-ms-office-lite.css
cat LICENSE >> ./dist/lf-documentation/browser/lf-ms-office-lite.css
echo "The following styles are copied from flatpickr.min.css */" >> ./dist/lf-documentation/browser/lf-ms-office-lite.css
cat ./node_modules/flatpickr/dist/flatpickr.min.css >> ./dist/lf-documentation/browser/lf-ms-office-lite.css
- name: "Copy lf-documentation/styles to ui-components/cdn"
run: cp lf-laserfiche-lite.css lf-ms-office-lite.css lf-laserfiche-lite.css.map lf-ms-office-lite.css.map ../../ui-components/cdn/
working-directory: ./dist/lf-documentation/browser
- name: "Move README to ui-components"
run: mv README.md ./dist/ui-components
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: npm-publish-artifact
# A file, directory or wildcard pattern that describes what to upload
path: |
./dist/ui-components
./dist/lf-documentation/browser
./types-lf-ui-components-publish/index.d.ts
./types-lf-ui-components-publish/index.js
- name: echo github run attempt
run: echo ${{ github.run_attempt }} ${{ github.event.pull_request.head.repo.owner.login }}
publish_to_npm_preview:
runs-on: ubuntu-latest
environment: npm_publish
if: ${{ github.run_attempt != 1 }}
needs: [build]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
- name: Download a Build Artifact
uses: actions/download-artifact@v8
with:
name: npm-publish-artifact
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: set NpmPackageVersion environment
id: preview_version
run: echo "value=${{ env.NPM_VERSION }}--preview-${{ github.run_id }}" >> $GITHUB_OUTPUT
- name: "copy license"
run: |
cp LICENSE ./types-lf-ui-components-publish
cp LICENSE ./dist/ui-components
- name: npm version @laserfiche/types-lf-ui-components
run: npm version ${{ steps.preview_version.outputs.value }} --no-git-tag-version
working-directory: ./types-lf-ui-components-publish
- name: Npm publish @laserfiche/types-lf-ui-components
run: npm publish --access public --tag next
working-directory: ./types-lf-ui-components-publish
- name: npm version @laserfiche/lf-ui-components
run: npm version ${{ steps.preview_version.outputs.value }} --no-git-tag-version
working-directory: ./dist/ui-components
- name: Npm publish @laserfiche/lf-ui-components
run: npm publish --access public --tag next
working-directory: ./dist/ui-components
- name: Tag commit
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ steps.preview_version.outputs.value }}
commit_sha: ${{ github.sha }}
message: Workflow run ${{github.server_url}}/${{github.repository}}/actions/runs/${{ github.run_id}}
publish_to_npm_release:
runs-on: ubuntu-latest
environment: npm_publish
if: ${{ github.run_attempt != 1 }}
needs: [build]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
- name: Download a Build Artifact
uses: actions/download-artifact@v8
with:
name: npm-publish-artifact
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: "copy license"
run: |
cp LICENSE ./types-lf-ui-components-publish
cp LICENSE ./dist/ui-components
- name: npm version @laserfiche/types-lf-ui-components
run: npm version ${{ env.NPM_VERSION }} --no-git-tag-version --allow-same-version
working-directory: ./types-lf-ui-components-publish
- name: Npm publish @laserfiche/types-lf-ui-components
run: npm publish --access public --tag latest
working-directory: ./types-lf-ui-components-publish
- name: npm version @laserfiche/lf-ui-components
run: npm version ${{ env.NPM_VERSION }} --no-git-tag-version --allow-same-version
working-directory: ./dist/ui-components
- name: Npm publish @laserfiche/lf-ui-components
run: npm publish --access public --tag latest
working-directory: ./dist/ui-components
- name: Tag commit
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ env.NPM_VERSION }}
commit_sha: ${{ github.sha }}
message: Workflow run ${{github.server_url}}/${{github.repository}}/actions/runs/${{ github.run_id}}
publish_documentation:
runs-on: ubuntu-latest
if: ${{ github.run_attempt != 1 }}
needs: [build]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
- name: Download a Build Artifact
uses: actions/download-artifact@v8
with:
name: npm-publish-artifact
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Npm install gulp
run: npm install gulp
- name: "gulp replaceVersionInDocumentation"
run: gulp replaceVersionInDocumentation --npmVersion ${{ env.NPM_VERSION }}
- name: "gulp replaceVersionInIndexHtml"
run: gulp replaceVersionInIndexHtml --npmVersion ${{ env.NPM_VERSION }}
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: ./dist/lf-documentation/browser
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5