From 7bc70fbcfacc115cccc81a2126233807ddadbc2b Mon Sep 17 00:00:00 2001 From: DevAlissu Date: Mon, 23 Mar 2026 15:12:40 -0400 Subject: [PATCH 1/2] separa pipeline em CI (pull request) e CD (deploy) - ci.yml: type check + build em pull requests com summary - deploy.yml: validacao + build + deploy na main com summary - ambos com cache npm e path filter --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 47 ++++++++++------------------- 2 files changed, 73 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ec815ce --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + pull_request: + branches: [main] + paths: + - 'src/**' + - 'public/**' + - 'package.json' + - 'package-lock.json' + - 'vite.config.ts' + - 'tsconfig.json' + - 'index.html' + +jobs: + validate: + name: Type check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - run: npm ci + + - run: npx tsc --noEmit + + build: + name: Build + needs: validate + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - run: npm ci + + - run: npm run build + + - name: Summary + run: | + BUNDLE_SIZE=$(du -sh dist/ | cut -f1) + echo "## Build validado" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Info | Valor |" >> $GITHUB_STEP_SUMMARY + echo "|------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| Bundle | \`${BUNDLE_SIZE}\` |" >> $GITHUB_STEP_SUMMARY + echo "| Node | \`$(node -v)\` |" >> $GITHUB_STEP_SUMMARY + echo "| TypeScript | Passou |" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f945ace..6499060 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy Portfolio +name: Deploy on: push: @@ -13,26 +13,8 @@ on: - 'index.html' jobs: - validate: - name: Validar - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - - - run: npm ci - - - name: Type check - run: npx tsc --noEmit - - build-deploy: + deploy: name: Build e Deploy - needs: validate runs-on: ubuntu-latest steps: @@ -47,6 +29,9 @@ jobs: - run: npm ci + - name: Type check + run: npx tsc --noEmit + - name: Build run: npm run build @@ -69,7 +54,7 @@ jobs: script: | sudo systemctl reload caddy - - name: Job summary + - name: Summary run: | COMMIT_MSG=$(git log -1 --pretty=format:'%s') COMMIT_HASH=$(git log -1 --pretty=format:'%h') @@ -77,14 +62,12 @@ jobs: FILES_CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | wc -l) BUNDLE_SIZE=$(du -sh dist/ | cut -f1) - cat >> $GITHUB_STEP_SUMMARY <> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Info | Valor |" >> $GITHUB_STEP_SUMMARY + echo "|------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| Commit | \`${COMMIT_HASH}\` — ${COMMIT_MSG} |" >> $GITHUB_STEP_SUMMARY + echo "| Autor | ${COMMIT_AUTHOR} |" >> $GITHUB_STEP_SUMMARY + echo "| Arquivos alterados | ${FILES_CHANGED} |" >> $GITHUB_STEP_SUMMARY + echo "| Bundle | \`${BUNDLE_SIZE}\` |" >> $GITHUB_STEP_SUMMARY + echo "| Destino | \`alissu.dev\` |" >> $GITHUB_STEP_SUMMARY From d4d8157c7dea47f17a0bd53342144c46fd010461 Mon Sep 17 00:00:00 2001 From: DevAlissu Date: Mon, 23 Mar 2026 15:13:22 -0400 Subject: [PATCH 2/2] inclui workflows no path filter do CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec815ce..e158cf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ on: - 'vite.config.ts' - 'tsconfig.json' - 'index.html' + - '.github/workflows/**' jobs: validate: