Skip to content

Commit

Permalink
Merge pull request #57 from pet-informatica/feat/ci-cd
Browse files Browse the repository at this point in the history
Implementa CI/CD com integração na VM
  • Loading branch information
AliceSales authored May 30, 2024
2 parents 0c14509 + b1682f3 commit 2caa9b5
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
name: build-and-deploy

name: Build and Deploy
on:
push:
branches: [ main ]

branches: [ "main" ]
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:
name: StaticOutput
path: /tmp/pet-informatica.github.io.tar.gz
deploy:
needs: build
runs-on:
- self-hosted
- linux
- x64
steps:
- name: Download build artifact
uses: actions/download-artifact@v2
with:
branch: gh-pages
folder: dist
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 2caa9b5

Please sign in to comment.