Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/actions gh pages #54

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/publish-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ _site
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# .public folder holds all static builds of /packages for github pages artifact
.public
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/ux-guidelines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down