Using Github Actions For Website Building
Academind

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.

Alois Napitalai

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.

Alois Napitalai

ICT Lab Manager at Surveying and Land Studies Dept(UNITECH)

1 年

For dev ops.

回复

要查看或添加评论,请登录

Alois Napitalai的更多文章

  • Using the Terminal in Ubuntu Server

    Using the Terminal in Ubuntu Server

    A graphical User Interface(GUI) makes it easy for us to navigate and do work especially in the Ubuntu desktop version…

    3 条评论
  • Logistic Regression

    Logistic Regression

    This is a follow up tutorial on my previous post linear regression on my road to understanding machine learning. As a…

    8 条评论
  • Road to Understanding Machine Learning

    Road to Understanding Machine Learning

    Traditional Machine Learning-Linear Regression Algorithm Machine learning is simply training a machine to make…

  • Automate a Full-stack Application Deployment Using GitHub Actions

    Automate a Full-stack Application Deployment Using GitHub Actions

    #githubactions #git #reactjs #expressjs #virtualization #fullstackdevelopment #githubrepository #statemanagement I have…

    2 条评论
  • Excel Functions and Formulas

    Excel Functions and Formulas

    I got stuck on excel formulas and functions the other day, it took me some time to get what I wanted. I have a little…

  • React and Ionic Routing

    React and Ionic Routing

    React Routing What is routing in react? Routing in React is the process of mapping URLs(uniform resource locators) to…

  • Persisting GeoSpatial Data in MongoDB

    Persisting GeoSpatial Data in MongoDB

    Persisting data is crucial in web applications, if data is not saved, the data is wiped out when a page refresh is done…

  • Under the Hood of React Components

    Under the Hood of React Components

    Doing It The JSX Way Components are the building blocks of react websites and UIs and these components are built using…

  • Web Proxy Authentication

    Web Proxy Authentication

    In my last article, I wrote about the installation of squid as a caching server that can be used to locally cache pages…

    7 条评论
  • Squid Cache Web Proxy

    Squid Cache Web Proxy

    Many computer networks tend to crawl when there are many users accessing the internet, or there are unwanted traffic…

    4 条评论

社区洞察

其他会员也浏览了