Skip to content

Commit c0e0885

Browse files
authored
Implementa CI/CD com integração na VM
1 parent 0c14509 commit c0e0885

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
1-
name: build-and-deploy
1+
name: Build and Deploy
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ "main", "feat/ci-cd" ]
66

77
jobs:
8-
build-and-deploy:
8+
build:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Setup Node.js
1212
uses: actions/[email protected]
1313
with:
1414
node-version: v16.19.1
15-
1615
- name: Checkout 🛎️
1716
uses: actions/[email protected]
18-
1917
- name: Build the website
18+
shell: bash
2019
run: |
2120
npm install
2221
npm run generate
23-
24-
- name: Deploy to GitHub Pages
25-
uses: JamesIves/[email protected]
22+
- name: Pack static output
23+
shell: bash
24+
run: |
25+
cd ./dist
26+
tar -czvf /tmp/pet-informatica.github.io.tar.gz .
27+
- name: Upload build artifact
28+
uses: actions/upload-artifact@v2
2629
with:
27-
branch: gh-pages
28-
folder: dist
30+
name: StaticOutput
31+
path: /tmp/pet-informatica.github.io.tar.gz
32+
deploy:
33+
runs-on:
34+
- self-hosted
35+
- linux
36+
- x64
37+
steps:
38+
- name: Download build artifact
39+
uses: actions/download-artifact@v2
40+
with:
41+
name: StaticOutput
42+
- name: Unpack and deploy
43+
shell: bash
44+
run: |
45+
rm -rf ${{ secrets.VM_PETSITE_PATH }}/*
46+
tar -xzf pet-informatica.github.io.tar.gz -C ${{ secrets.VM_PETSITE_PATH }}
47+
rm -rf pet-informatica.github.io.tar.gz

0 commit comments

Comments
 (0)