From fe727b9996adf6adc04556db133390558d815dba Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Mon, 14 Aug 2023 13:30:08 -0400 Subject: [PATCH 1/3] squash --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1044bcb0..bd19829a 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,6 @@ _site .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# .public folder houses all static builds of /packages +.public \ No newline at end of file From cec35a239bd059fd7f2dfcb0237df8c3afcad72b Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Mon, 14 Aug 2023 15:31:55 -0400 Subject: [PATCH 2/3] chore: create npm scripts for .public build for gh-pages --- .gitignore | 2 +- package.json | 3 ++- packages/react-components/package.json | 3 ++- packages/ux-guidelines/package.json | 3 ++- packages/vanilla/package.json | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index bd19829a..f0128fbe 100644 --- a/.gitignore +++ b/.gitignore @@ -138,5 +138,5 @@ _site .yarn/install-state.gz .pnp.* -# .public folder houses all static builds of /packages +# .public folder holds all static builds of /packages for github pages artifact .public \ No newline at end of file diff --git a/package.json b/package.json index 7d30ddd1..60219232 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "ux-build": "npm run build -w packages/ux-guidelines", "react-sb": "npm run storybook -w packages/react-components", "react-build": "npm run build -w packages/react-components", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "build-all": "npm run vanilla-build && npm run build-pages -w packages/ux-guidelines && npm run build-pages -w packages/vanilla && npm run build-pages -w packages/react-components" }, "repository": { "type": "git", diff --git a/packages/react-components/package.json b/packages/react-components/package.json index c43a7a73..f9d09651 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -19,7 +19,8 @@ "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "storybook": "storybook dev -p 6007", - "build-storybook": "storybook build" + "build-storybook": "storybook build", + "build-pages": "storybook build -o ../../.public/react-sb" }, "dependencies": { "react": "^18.2.0", diff --git a/packages/ux-guidelines/package.json b/packages/ux-guidelines/package.json index 48423a53..5eac9fb5 100644 --- a/packages/ux-guidelines/package.json +++ b/packages/ux-guidelines/package.json @@ -9,7 +9,8 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "npx @11ty/eleventy --serve", - "build": "npx @11ty/eleventy" + "build": "npx @11ty/eleventy", + "build-pages": "npx @11ty/eleventy --output=../../.public/ux-guidelines" }, "repository": { "type": "git", diff --git a/packages/vanilla/package.json b/packages/vanilla/package.json index 355ff278..b9d4b444 100644 --- a/packages/vanilla/package.json +++ b/packages/vanilla/package.json @@ -23,7 +23,8 @@ "preview": "vite preview", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "storybook-static": "npm run build && npm run build-storybook && copy dist storybook-static/assets && npx http-server storybook-static" + "storybook-static": "npm run build && npm run build-storybook && copy dist storybook-static/assets && npx http-server storybook-static", + "build-pages": "storybook build -o ../../.public/vanilla-sb" }, "devDependencies": { "@babel/core": "^7.20.12", From facdd833edcde1d70c2e5234102d681cc43004a2 Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Mon, 14 Aug 2023 16:38:25 -0400 Subject: [PATCH 3/3] feat: action to deploy design system to gh-pages --- .github/workflows/publish-gh-pages.yml | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/publish-gh-pages.yml diff --git a/.github/workflows/publish-gh-pages.yml b/.github/workflows/publish-gh-pages.yml new file mode 100644 index 00000000..012923ae --- /dev/null +++ b/.github/workflows/publish-gh-pages.yml @@ -0,0 +1,64 @@ +name: Deploy Github Pages +run-name: ${{ github.actor }} is deploying the design system to Github Pages +on: + workflow_dispatch: + + push: + branches: + - main + + +# Grant GITHUB_TOKEN the permissions required to make a Pages deployment +permissions: + contents: read + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + +jobs: + build: + name: build static content + timeout-minutes: 15 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + cache: npm + - run: npm ci # runs clean-install + - run: npm run build-all # build all static sites in all packages + + - name: Archive artifact + shell: sh + if: runner.os == 'Linux' + run: | + tar \ + --dereference --hard-dereference \ + --directory ".public" \ + -cvf "$RUNNER_TEMP/artifact.tar" \ + --exclude=.git \ + --exclude=.github \ + . + + - uses: actions/upload-artifact@v3 + with: + name: github-pages + path: ${{ runner.temp }}/artifact.tar + retention-days: "1" + if-no-files-found: error + + deploy: + needs: build + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2