91 lines
3.1 KiB
YAML
91 lines
3.1 KiB
YAML
name: Vercel Deploy Next
|
|
env:
|
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
ALIASES: ${{ vars.ALIASES }}
|
|
MAIN_MENU_LINKS: ${{ vars.MAIN_MENU_LINKS }}
|
|
on:
|
|
push:
|
|
branches:
|
|
- next
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
- name: Install Global Dependencies
|
|
run: pnpm add -g vercel
|
|
- name: Install Dependencies
|
|
run: pnpm install
|
|
- name: Pull Vercel Environment Information
|
|
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
|
- name: Write Release Info
|
|
run: |
|
|
echo "{\"latestTag\": \"$(git rev-parse --short $GITHUB_SHA)\", \"isCommit\": true}" > assets/release.json
|
|
- name: Download Generated Sounds map
|
|
run: node scripts/downloadSoundsMap.mjs
|
|
- name: Build Project Artifacts
|
|
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
|
env:
|
|
CONFIG_JSON_SOURCE: BUNDLED
|
|
- run: pnpm build-storybook
|
|
- name: Copy playground files
|
|
run: |
|
|
mkdir -p .vercel/output/static/playground
|
|
pnpm build-playground
|
|
cp -r renderer/dist/* .vercel/output/static/playground/
|
|
- name: Deploy Project Artifacts to Vercel
|
|
uses: mathiasvr/command-output@v2.0.0
|
|
with:
|
|
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
|
id: deploy
|
|
- name: Start servers for testing
|
|
run: |
|
|
nohup pnpm prod-start &
|
|
nohup pnpm test-mc-server &
|
|
- name: Run Cypress smoke tests
|
|
uses: cypress-io/github-action@v5
|
|
with:
|
|
install: false
|
|
spec: cypress/e2e/smoke.spec.ts
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: cypress-smoke-test-screenshots
|
|
path: cypress/screenshots/
|
|
- name: Set deployment aliases
|
|
run: |
|
|
for alias in $(echo ${{ secrets.TEST_PREVIEW_DOMAIN }} | tr "," "\n"); do
|
|
vercel alias set ${{ steps.deploy.outputs.stdout }} $alias --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
|
|
done
|
|
|
|
- name: Create Release Pull Request
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
const { data: pulls } = await github.rest.pulls.list({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
head: `${context.repo.owner}:next`,
|
|
base: 'release',
|
|
state: 'open'
|
|
});
|
|
|
|
if (pulls.length === 0) {
|
|
await github.rest.pulls.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
title: 'Release',
|
|
head: 'next',
|
|
base: 'release',
|
|
body: 'PR was created automatically by the release workflow, hope you release it as soon as possible!',
|
|
});
|
|
}
|