Using Github Actions For Website Building
name: Website Deployment Automation
on: push
jobs:
installs:
runs-on: ubuntu-latest
steps:
- name: Get code from local to gh runner
uses: actions/checkout@v3
- name: Install nodejs 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run build
run: npm run build
- name: Copy folder content recursively to remote VPS
uses: garygrossgarten/github-action-scp@release
with:
local: dist
remote: /var/www/www.unitechchaplaincy.com/public_html/
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASSWORD }}
Above is a code snippet used to deploy websites to a remote web-server.
领英推荐
After every push to the github repo, reactjs code is copied into a github runner, installs nodejs v18, does a "npm install" of the dependencies, then a "npm run build" to get a dist(name of the folder containing the bundled website) artifact that is copied into the remote webserver via SSH to the specified remote location.
This makes static website building easy, we do the changes locally and then pushed to github that initiated the automation process.
ICT Lab Manager at Surveying and Land Studies Dept(UNITECH)
1 年https://taraka-uc.com/ is the proof of concept and currently working on unitech chaplaincy website.
ICT Lab Manager at Surveying and Land Studies Dept(UNITECH)
1 年For dev ops.