Adds build check on PR opening #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: [ "main" ] | |
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: | |
needs: build | |
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 |