Skip to content

Implementa CI/CD com integração na VM #32

Implementa CI/CD com integração na VM

Implementa CI/CD com integração na VM #32

name: Build and Deploy
on:
push:
branches: [ "main", "feat/ci-cd" ]
jobs:
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: 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:
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