Repository navigation
86 lines (70 loc) · 2.2 KB
/
Copy pathdeploy.yml
File metadata and controls
86 lines (70 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Validar e publicar portfólio
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
permissions:
contents: read
concurrency:
group: portfolio-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
validar:
name: Validar código
if: github.event.action != 'closed' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Obter código
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- name: Configurar Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Instalar dependências
run: npm ci
- name: Executar verificações e build
run: npm run check
- name: Executar testes
run: npm run test --if-present
publicar:
name: Publicar na branch gh-pages
if: github.event.action == 'closed' && github.event.pull_request.merged == true
needs: validar
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Obter versão integrada na main
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: main
persist-credentials: false
- name: Configurar Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: npm
- name: Instalar dependências
run: npm ci
- name: Gerar site de produção
run: npm run build
- name: Configurar autoria do commit de publicação
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Publicar arquivos estáticos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
npx gh-pages -d dist -b gh-pages