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
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
pull_request:
branches: [main]
paths:
- 'src/**'
- 'public/**'
- 'package.json'
- 'package-lock.json'
- 'vite.config.ts'
- 'tsconfig.json'
- 'index.html'
- '.github/workflows/**'

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
47 changes: 15 additions & 32 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Portfolio
name: Deploy

on:
push:
Expand All @@ -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:
Expand All @@ -47,6 +29,9 @@ jobs:

- run: npm ci

- name: Type check
run: npx tsc --noEmit

- name: Build
run: npm run build

Expand All @@ -69,22 +54,20 @@ 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')
COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an')
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 <<EOF
## Deploy concluido

| Info | Valor |
|------|-------|
| Commit | \`${COMMIT_HASH}\` — ${COMMIT_MSG} |
| Autor | ${COMMIT_AUTHOR} |
| Arquivos alterados | ${FILES_CHANGED} |
| Tamanho do bundle | ${BUNDLE_SIZE} |
| Destino | \`ubuntu@159.112.183.153:~/portfolio\` |
EOF
echo "## Deploy concluido" >> $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
Loading