Skip to content

Commit 7d1e2d5

Browse files
MarconiGRFMarconi Gomes
authored and
Marconi Gomes
committed
Implementa CI/CD com integração na VM
1 parent 0c14509 commit 7d1e2d5

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,46 @@
1-
name: build-and-deploy
2-
1+
name: Build and Deploy
32
on:
43
push:
5-
branches: [ main ]
6-
4+
branches: [ "main", "feat/ci-cd" ]
75
jobs:
8-
build-and-deploy:
6+
build:
97
runs-on: ubuntu-latest
108
steps:
119
- name: Setup Node.js
1210
uses: actions/[email protected]
1311
with:
1412
node-version: v16.19.1
15-
1613
- name: Checkout 🛎️
1714
uses: actions/[email protected]
18-
1915
- name: Build the website
16+
shell: bash
2017
run: |
2118
npm install
2219
npm run generate
23-
24-
- name: Deploy to GitHub Pages
25-
uses: JamesIves/[email protected]
20+
- name: Pack static output
21+
shell: bash
22+
run: |
23+
cd ./dist
24+
tar -czvf /tmp/pet-informatica.github.io.tar.gz .
25+
- name: Upload build artifact
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: StaticOutput
29+
path: /tmp/pet-informatica.github.io.tar.gz
30+
deploy:
31+
needs: build
32+
runs-on:
33+
- self-hosted
34+
- linux
35+
- x64
36+
steps:
37+
- name: Download build artifact
38+
uses: actions/download-artifact@v2
2639
with:
27-
branch: gh-pages
28-
folder: dist
40+
name: StaticOutput
41+
- name: Unpack and deploy
42+
shell: bash
43+
run: |
44+
rm -rf ${{ secrets.VM_PETSITE_PATH }}/*
45+
tar -xzf pet-informatica.github.io.tar.gz -C ${{ secrets.VM_PETSITE_PATH }}
46+
rm -rf pet-informatica.github.io.tar.gz

0 commit comments

Comments
 (0)