Skip to content

Commit 712162d

Browse files
refatora o workflow de deploy para melhorar a estrutura e a legibilidade
1 parent 14e6ffa commit 712162d

File tree

1 file changed

+24
-36
lines changed

1 file changed

+24
-36
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,51 @@
1-
name: Deploy website 🚀
1+
name: Build and Deploy
22

33
on:
4-
# Runs on pushes targeting the default branch
54
push:
6-
branches: ['main']
5+
branches: [main]
76

8-
# Allows you to run this workflow manually from the Actions tab
9-
workflow_dispatch:
10-
11-
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
127
permissions:
138
contents: read
149
pages: write
1510
id-token: write
1611

17-
# Allow one concurrent deployment
1812
concurrency:
19-
group: 'pages'
20-
cancel-in-progress: true
13+
group: "pages"
14+
cancel-in-progress: false
2115

2216
jobs:
23-
deploy:
24-
if: github.repository == 'PythonNorteBrasil/site'
25-
environment:
26-
name: production
27-
url: ${{ steps.deployment.outputs.page_url }}
17+
build:
2818
runs-on: ubuntu-latest
29-
outputs:
30-
artifact_id: ${{ steps.upload-artifact.outputs.artifact-id }}
3119
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
20+
- uses: actions/checkout@v4
3421

35-
- name: Set up Node
22+
- name: Setup Node.js
3623
uses: actions/setup-node@v4
3724
with:
38-
node-version: 20
25+
node-version: '20'
3926
cache: 'npm'
4027

4128
- name: Install dependencies
42-
run: npm install --force
43-
44-
- name: Build
45-
run: npm run build
29+
run: npm ci --force
4630

47-
- name: Setup Pages
48-
uses: actions/configure-pages@v4
31+
- name: Build & Export static Next.js
32+
env:
33+
NEXT_PUBLIC_BASE_PATH: /site
34+
run: |
35+
npx next build
4936
50-
- name: Upload artifact
51-
id: upload-artifact
37+
- name: Upload build output
5238
uses: actions/upload-pages-artifact@v3
5339
with:
54-
# Upload dist repository
55-
path: './.next/dist'
56-
name: 'github-pages'
57-
retention-days: "1"
40+
path: ./out
5841

42+
deploy:
43+
needs: build
44+
runs-on: ubuntu-latest
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
steps:
5949
- name: Deploy to GitHub Pages
6050
id: deployment
61-
uses: actions/deploy-pages@v4
62-
with:
63-
artifact_name: 'github-pages'
51+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)