Skip to content

esm import

esm import #2

name: Docs Preview Deploy
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm install @vercel/sdk
- uses: actions/github-script@v7
env:
VERCEL_TOKEN: secrets.VERCEL_TOKEN
VERCEL_TEAM_ID: secrets.VERCEL_TEAM_ID
with:
script: |
const { Vercel } = await import("@vercel/sdk");
const vercel = new Vercel({
bearerToken: process.env.VERCEL_TOKEN,
});
const deployment = await vercel.deployments.createDeployment({
teamId: process.env.VERCEL_TEAM_ID,
requestBody: {
name: "edgedb-docs",
gitSource: {
type: "github",
org: "edgedb",
repo: "edgedb.com",
ref: "docs-preview",
},
projectSettings: {
buildCommand:
`EDGEDB_REPO_BRANCH=${process.env.GITHUB_REF_NAME} yarn vercel-build`,
},
},
});
console.log(deployment.url);