62 lines
2.5 KiB
YAML
62 lines
2.5 KiB
YAML
name: Vercel Deploy Preview
|
|
env:
|
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
ALIASES: ${{ vars.ALIASES }}
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
# todo skip already created deploys on that commit
|
|
if: >-
|
|
github.event.issue.pull_request != '' &&
|
|
(
|
|
contains(github.event.comment.body, '/deploy')
|
|
)
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: refs/pull/${{ github.event.issue.number }}/head
|
|
- run: npm i -g pnpm@9.0.4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
cache: "pnpm"
|
|
- name: Install Global Dependencies
|
|
run: npm install --global vercel
|
|
- name: Pull Vercel Environment Information
|
|
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
|
- name: Build Project Artifacts
|
|
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
|
- run: pnpm build-storybook
|
|
- name: Copy playground files
|
|
run: pnpm build-playground && cp prismarine-viewer/public/index.html .vercel/output/static/playground.html && cp prismarine-viewer/public/playground.js .vercel/output/static/playground.js
|
|
- name: Download Generated Sounds map
|
|
run: node scripts/downloadSoundsMap.mjs
|
|
- name: Deploy Project Artifacts to Vercel
|
|
uses: mathiasvr/command-output@v2.0.0
|
|
with:
|
|
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
|
id: deploy
|
|
- uses: mshick/add-pr-comment@v2
|
|
with:
|
|
allow-repeats: true
|
|
message: |
|
|
Deployed to Vercel Preview: ${{ steps.deploy.outputs.stdout }}
|
|
[Playground](${{ steps.deploy.outputs.stdout }}/playground.html)
|
|
[Storybook](${{ steps.deploy.outputs.stdout }}/storybook/)
|
|
# - run: git checkout next scripts/githubActions.mjs
|
|
- name: Get deployment alias
|
|
run: node scripts/githubActions.mjs getAlias
|
|
id: alias
|
|
env:
|
|
ALIASES: ${{ env.ALIASES }}
|
|
PULL_URL: ${{ github.event.issue.pull_request.url }}
|
|
- name: Set deployment alias
|
|
if: ${{ steps.alias.outputs.alias != '' && steps.alias.outputs.alias != 'mcraft.fun' && steps.alias.outputs.alias != 's.mcraft.fun' }}
|
|
run: vercel alias set ${{ steps.deploy.outputs.stdout }} ${{ steps.alias.outputs.alias }} --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
|