ci: add deployment to vercel
This commit is contained in:
parent
3672b85330
commit
e006bfe5b7
|
@ -1,4 +1,4 @@
|
|||
name: 'Deploy Storybook'
|
||||
name: 'Deployment'
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -69,3 +69,11 @@ jobs:
|
|||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
||||
- name: Log in to Vercel
|
||||
run: yarn vercel login --token ${{ secrets.vercel_token }}
|
||||
- name: Pull Vercel configuration
|
||||
run: yarn vercel pull --yes
|
||||
- name: Build Vercel bundle
|
||||
run: yarn vercel build --prod
|
||||
- name: Deploy to Vercel
|
||||
run: yarn vercel deploy --prebuilt --prod
|
|
@ -70,3 +70,43 @@ jobs:
|
|||
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
|
||||
"npx http-server storybook-static --port 6006 --silent" \
|
||||
"npx wait-on tcp:127.0.0.1:6006 && yarn test-storybook"
|
||||
|
||||
deployment:
|
||||
runs-on: ubuntu-latest
|
||||
needs: cache-dependencies
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '18.x'
|
||||
- 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: Log in to Vercel
|
||||
run: yarn vercel login --token ${{ secrets.vercel_token }}
|
||||
- name: Pull Vercel configuration
|
||||
run: yarn vercel pull --yes
|
||||
- name: Build Vercel bundle
|
||||
run: yarn vercel build
|
||||
- name: Deploy to Vercel
|
||||
run: yarn vercel deploy --prebuilt > _vercel-deployment-url
|
||||
- name: Comment on PR with deployment URL
|
||||
uses: actions/github-script@v4
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const deploymentUrl = fs.readFileSync('_vercel-deployment-url', 'utf8');
|
||||
github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `Deployed to ${deploymentUrl}`,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue