From 86ccec3e7eab27f54aaa209df6038ec960204643 Mon Sep 17 00:00:00 2001 From: Elliott Marquez <5981958+e111077@users.noreply.github.com> Date: Thu, 27 Jul 2023 09:17:27 -0700 Subject: [PATCH] build: use firebase for hosting and remove url prefixes --- .github/workflows/deploy-catalog.yml | 23 ----- .github/workflows/firebase-hosting-merge.yml | 27 ++++++ .../firebase-hosting-pull-request.yml | 24 +++++ button/demo/project.json | 2 +- catalog/.firebaserc | 5 ++ .../plugins/copy-code-button.cjs | 2 +- .../shortcodes/playground-example.cjs | 4 +- catalog/eleventy.config.cjs | 5 ++ catalog/firebase.json | 35 ++++++++ catalog/package.json | 13 +-- catalog/site/_includes/default.html | 12 +-- .../site/_includes/layouts/components.html | 8 +- catalog/site/css/global.css | 4 +- catalog/site/index.html | 4 +- catalog/src/components/top-app-bar.ts | 6 +- checkbox/demo/project.json | 2 +- chips/demo/project.json | 2 +- dialog/demo/project.json | 2 +- divider/demo/project.json | 2 +- elevation/demo/project.json | 2 +- fab/demo/project.json | 2 +- field/demo/project.json | 2 +- focus/demo/project.json | 2 +- iconbutton/demo/project.json | 2 +- labs/navigationbar/demo/project.json | 2 +- labs/segmentedbuttonset/demo/project.json | 2 +- list/demo/project.json | 2 +- menu/demo/project.json | 2 +- package-lock.json | 90 ++++++++++++++++++- package.json | 1 - progress/demo/project.json | 2 +- radio/demo/project.json | 2 +- ripple/demo/project.json | 2 +- select/demo/project.json | 2 +- slider/demo/project.json | 2 +- switch/demo/project.json | 2 +- tabs/demo/project.json | 2 +- textfield/demo/project.json | 2 +- 38 files changed, 235 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/deploy-catalog.yml create mode 100644 .github/workflows/firebase-hosting-merge.yml create mode 100644 .github/workflows/firebase-hosting-pull-request.yml create mode 100644 catalog/.firebaserc create mode 100644 catalog/firebase.json diff --git a/.github/workflows/deploy-catalog.yml b/.github/workflows/deploy-catalog.yml deleted file mode 100644 index 97f4ee791..000000000 --- a/.github/workflows/deploy-catalog.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build and Deploy Catalog -on: - push: - branches: main -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: npm - - uses: google/wireit@setup-github-actions-caching/v1 - - - run: npm ci - - run: npm run build:catalog - - - name: Deploy Catalog - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - branch: gh-pages - folder: catalog/_prod \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml new file mode 100644 index 000000000..14a974e1f --- /dev/null +++ b/.github/workflows/firebase-hosting-merge.yml @@ -0,0 +1,27 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on merge +'on': + push: + branches: + - main +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm + - uses: google/wireit@setup-github-actions-caching/v1 + - run: npm ci + - run: 'npm run build:catalog' + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_MATERIAL_WEB_CATALOG }}' + channelId: live + projectId: material-web-catalog + entryPoint: catalog diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 000000000..1f8893b69 --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,24 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on PR +'on': pull_request +jobs: + build_and_preview: + if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm + - uses: google/wireit@setup-github-actions-caching/v1 + - run: npm ci + - run: 'npm run build:catalog' + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_MATERIAL_WEB_CATALOG }}' + projectId: material-web-catalog + entryPoint: catalog diff --git a/button/demo/project.json b/button/demo/project.json index b9053089a..92f3e7958 100644 --- a/button/demo/project.json +++ b/button/demo/project.json @@ -1,5 +1,5 @@ { - "extends": "/material-web/assets/stories/base.json", + "extends": "/assets/stories/base.json", "files": { "demo.ts": { "hidden": true diff --git a/catalog/.firebaserc b/catalog/.firebaserc new file mode 100644 index 000000000..512b40792 --- /dev/null +++ b/catalog/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "material-web-catalog" + } +} diff --git a/catalog/eleventy-helpers/plugins/copy-code-button.cjs b/catalog/eleventy-helpers/plugins/copy-code-button.cjs index f3ddb846d..77c2c27f2 100644 --- a/catalog/eleventy-helpers/plugins/copy-code-button.cjs +++ b/catalog/eleventy-helpers/plugins/copy-code-button.cjs @@ -27,7 +27,7 @@ function renderCode(originalRule) { return ` ${originalHTMLContent} diff --git a/catalog/eleventy-helpers/shortcodes/playground-example.cjs b/catalog/eleventy-helpers/shortcodes/playground-example.cjs index 9289752ba..bf7371de6 100644 --- a/catalog/eleventy-helpers/shortcodes/playground-example.cjs +++ b/catalog/eleventy-helpers/shortcodes/playground-example.cjs @@ -53,9 +53,9 @@ function playgroundExample(eleventyConfig) { Expand interactive demo. -