2023-08-23 16:01:25 +00:00
|
|
|
name: 'Deployment'
|
2023-08-21 12:33:30 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: "pages"
|
|
|
|
cancel-in-progress: false
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
cache-dependencies:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Commit
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Cache yarn dependencies and cypress
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
|
|
|
- name: Install dependencies if cache invalid
|
|
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
|
|
run: yarn
|
|
|
|
|
|
|
|
build-and-deploy:
|
|
|
|
environment:
|
|
|
|
name: github-pages
|
|
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: cache-dependencies
|
|
|
|
steps:
|
2023-08-21 12:44:27 +00:00
|
|
|
- uses: actions/checkout@v2
|
2023-08-21 12:33:30 +00:00
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '18.x'
|
|
|
|
- name: Setup Pages
|
|
|
|
uses: actions/configure-pages@v3
|
|
|
|
- name: Restore yarn dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/Cypress
|
|
|
|
node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-v3-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-v3
|
|
|
|
- name: Install Playwright
|
|
|
|
run: npx playwright install --with-deps
|
|
|
|
- name: Build Storybook
|
2023-08-22 05:18:57 +00:00
|
|
|
run: yarn build-storybook --quiet
|
2023-08-21 12:33:30 +00:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-pages-artifact@v2
|
|
|
|
with:
|
|
|
|
path: './storybook-static'
|
|
|
|
- name: Deploy to GitHub Pages
|
|
|
|
id: deployment
|
|
|
|
uses: actions/deploy-pages@v2
|
2023-08-23 16:01:25 +00:00
|
|
|
- name: Pull Vercel configuration
|
2023-08-23 16:19:30 +00:00
|
|
|
run: yarn vercel pull --yes --token ${{ secrets.vercel_token }}
|
2023-08-23 16:01:25 +00:00
|
|
|
- name: Build Vercel bundle
|
|
|
|
run: yarn vercel build --prod
|
|
|
|
- name: Deploy to Vercel
|
2023-08-23 16:19:30 +00:00
|
|
|
run: yarn vercel deploy --prebuilt --prod --token ${{ secrets.vercel_token }}
|