This commit is contained in:
1 parent
a97985633d
commit
fbcedc062f
1 file changed
+8
-10
@@ -2,7 +2,9 @@
|
||||
# - Token: secret VERCEL_TOKEN de nivel de usuario no Gitea (vale para todos os repos).
|
||||
# - Projeto na Vercel = nome do repo; e criado na primeira execucao se nao existir.
|
||||
# - Branch padrao do repo -> producao; demais branches -> preview.
|
||||
# - Opcionais (Actions > Variables do repo): VERCEL_PROJECT (outro nome), NODE_VERSION (padrao 22).
|
||||
# - O build roda na infraestrutura da Vercel (o runner so envia o codigo), entao
|
||||
# versao do Node, gerenciador de pacotes e variaveis de ambiente vem do projeto na Vercel.
|
||||
# - Opcional (Actions > Variables do repo): VERCEL_PROJECT (nome diferente do repo).
|
||||
name: Deploy Vercel
|
||||
|
||||
"on":
|
||||
@@ -15,23 +17,19 @@ jobs:
|
||||
env:
|
||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||
VERCEL_SCOPE: asemlk54-1928s-projects
|
||||
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ vars.NODE_VERSION || '22' }}
|
||||
# corepack respeita o "packageManager" do package.json (pnpm/yarn na versao certa)
|
||||
- run: npm install --global corepack@latest vercel@latest && corepack enable
|
||||
node-version: 22
|
||||
- run: npm install --global vercel@latest
|
||||
- name: Deploy
|
||||
run: |
|
||||
PROJECT=$(echo "${{ vars.VERCEL_PROJECT || github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
|
||||
if [ "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]; then
|
||||
ENV=production; PROD=--prod
|
||||
PROD=--prod
|
||||
else
|
||||
ENV=preview; PROD=
|
||||
PROD=
|
||||
fi
|
||||
vercel link --yes --project "$PROJECT" --scope "$VERCEL_SCOPE" --token "$VERCEL_TOKEN"
|
||||
vercel pull --yes --environment=$ENV --token "$VERCEL_TOKEN"
|
||||
vercel build $PROD --token "$VERCEL_TOKEN"
|
||||
vercel deploy --prebuilt $PROD --token "$VERCEL_TOKEN"
|
||||
vercel deploy $PROD --token "$VERCEL_TOKEN"
|
||||
Reference in new issue
Block a user