DEV Community

es404020
es404020

Posted on

1

Gastby js deployment to SSH server using Github action.

This is a simple code snippet that shows how you can deploy you Gatsby.js application to an SSH server using Github actions.

Create a main.yaml in your .github/workflow


name: blog
on:
  push:
    branches: main
jobs:
  build-and-deploy:
    name: Build and deploy Gatsby site
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2.3.1

      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '13.x'

      - name: Install Project Dependencies
        run: npm install

      - name: Install Gatsby CLI
        run: npm install -g gatsby-cli@2.12.34

      - name: Build
        run: gatsby build --prefix-paths

      - name: Verify build
        run: ls -la public

      - name: copy file via ssh key
        uses: appleboy/scp-action@master
        env:
          HOST:  
          PORT:  
          USERNAME:  
          PASSWORD: 
        with:
          source: "./public"
          target: "/var/www/html/blog"
          strip_components: 2 # this is important






Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more