Skip to content

Commit

Permalink
Implementa CI/CD com integração na VM
Browse files Browse the repository at this point in the history
  • Loading branch information
MarconiGRF authored May 30, 2024
1 parent 0c14509 commit c0e0885
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
name: build-and-deploy
name: Build and Deploy

on:
push:
branches: [ main ]
branches: [ "main", "feat/ci-cd" ]

jobs:
build-and-deploy:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: v16.19.1

- name: Checkout 🛎️
uses: actions/[email protected]

- name: Build the website
shell: bash
run: |
npm install
npm run generate
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
- name: Pack static output
shell: bash
run: |
cd ./dist
tar -czvf /tmp/pet-informatica.github.io.tar.gz .
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
branch: gh-pages
folder: dist
name: StaticOutput
path: /tmp/pet-informatica.github.io.tar.gz
deploy:
runs-on:
- self-hosted
- linux
- x64
steps:
- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: StaticOutput
- name: Unpack and deploy
shell: bash
run: |
rm -rf ${{ secrets.VM_PETSITE_PATH }}/*
tar -xzf pet-informatica.github.io.tar.gz -C ${{ secrets.VM_PETSITE_PATH }}
rm -rf pet-informatica.github.io.tar.gz

0 comments on commit c0e0885

Please sign in to comment.