Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 28 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@ jobs:

- name: Run tests
run: pnpm run test:ci

# --- REMOVIDO 'pnpm run build' ---
# --- REMOVIDO 'Upload build artifact' ---

# -----------------------------------------------------------------
# JOB 2: Deploy para Produção (Vercel)
# -----------------------------------------------------------------
deploy-production:
name: Deploy to Production
needs: test-and-lint # Depende do job de teste
needs: test-and-lint
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
deployments: write
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

steps:
- name: Checkout code
uses: actions/checkout@v4

# Adicionamos a instalação aqui, pois a Vercel CLI pode precisar
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
Expand All @@ -72,32 +72,32 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# --- REMOVIDO 'Download build artifact' ---

- name: Deploy to Vercel (Production)
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
# --- MUDANÇA CRÍTICA ---
# Deixamos a Vercel fazer o build
vercel-args: "--prod"
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
run: |
pnpm vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
pnpm vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
pnpm vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

# -----------------------------------------------------------------
# JOB 3: Deploy de Preview
# -----------------------------------------------------------------
deploy-preview:
name: Deploy Preview
needs: test-and-lint # Depende do job de teste
needs: test-and-lint
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
deployments: write
if: github.event_name == 'pull_request' || (github.ref == 'refs/heads/develop' && github.event_name == 'push')

steps:
- name: Checkout code
uses: actions/checkout@v4

# Adicionamos a instalação aqui
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
Expand All @@ -112,27 +112,24 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# --- REMOVIDO 'Download build artifact' ---

- name: Deploy to Vercel (Preview)
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
# --- MUDANÇA CRÍTICA ---
# Deixamos a Vercel fazer o build
vercel-args: ""
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
run: |
pnpm vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }}
pnpm vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

# -----------------------------------------------------------------
# JOB 4: Criar Tag de Versão (Sem mudanças)
# -----------------------------------------------------------------
tag-release:
name: Tag Release
needs: deploy-production # <-- Roda APÓS o deploy de produção
needs: deploy-production
runs-on: ubuntu-latest
permissions:
contents: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -152,12 +149,11 @@ jobs:
echo "Tag $TAG_VERSION does not exist. Proceeding..."
echo "SKIP_TAG=false" >> $GITHUB_ENV
fi

- name: Create and Push Tag
if: env.SKIP_TAG == 'false'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag $TAG_VERSION -m "Release $TAG_VERSION"
git push origin $TAG_VERSION

git push origin $TAG_VERSION
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"sass": "^1.93.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.2",
"vercel": "^34.2.0",
"vite": "^7.1.12"
}
}
Loading