Giter Site home page Giter Site logo

basemax / githubaction-jekyll-sftp-deploy-password Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 26 KB

This is a guide and template for deploying a Jekyll site by FTP/SFTP to the server with GitHub Actions. Usually, you can easily deploy your Jekyll application in GitHub Pages, but sometimes you need to deploy your site to your own server by FTP/SFTP. This guide will help you to do that.

License: GNU General Public License v3.0

deploy github-actions jekyll jekyll-build jekyll-ecosystem ruby workflow workflows deploy-jekyll jekyll-deploy

githubaction-jekyll-sftp-deploy-password's Introduction

GitHub Actions: Deploy Jekyll to SFTP with password

This is a guide and template for deploying a Jekyll site by FTP/SFTP to the server with GitHub Actions. Usually, you can easily deploy your Jekyll application in GitHub Pages, but sometimes you need to deploy your site to your own server by FTP/SFTP. This guide will help you to do that.

GitHub Actions

GitHub Actions is a service that allows you to run your own scripts on GitHub's infrastructure. You can use it to automate tasks like building and testing your code, or deploying your site to a server.

GitHub Actions are great to use in projects. Happy coding ^_^

Why this one and GitHub Actions?

It took me a few hours to prepare and test this configuration, I'm happy to share this for free to save others time.

Example

Create .github/workflows/deploy.yml file.

You can see an example workflow in the following:

on: [push]

jobs:
  mirror_with_sftp:
    name: deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.7.4' # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically

      - name: Bundle install
        env:
          RAILS_ENV: test
        run: |
          bundle install --jobs 4 --retry 3

      - name: ๐Ÿ”จ Build Project
        run: |
          bundle exec jekyll build

      - name: List output files
        run: |
          find ./_site/ -print

      - name: FTP Deployer
        uses: sand4rt/[email protected]
        with:
          sftp: true
          host: ${{ secrets.SERVER_HOST }}
          port: 22
          username: ${{ secrets.SERVER_USERNAME }}
          password: ${{ secrets.SERVER_PASSWORD }}
          remote_folder: ${{ secrets.SERVER_PATH }}
          local_folder: './_site/'
          cleanup: false
          include: '[ "*", "**/*" ]'
          exclude: '[".htaccess", ".github/**", ".git/**", "*.env"]'
          pasive: true

Note that you need to add your secrets to the repository settings. You need to define the following secrets:

  • SERVER_HOST
  • SERVER_USERNAME
  • SERVER_PASSWORD
  • SERVER_PATH

Show case

I am using this workflow in my personal website, because I want to deploy my site to my own server by FTP/SFTP. You can see the source code of my website in the following: https://github.com/BaseMax/Max

Read more

ยฉ Copyright Max Base, 2022

githubaction-jekyll-sftp-deploy-password's People

Contributors

basemax avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.