GithubHelp home page GithubHelp logo

ecogit-stage / github-actions-deploy-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bridgecrew-perf6/github-actions-deploy-1

0.0 0.0 0.0 10 KB

Deploy to a server with GitHub Actions using SSH

License: MIT License

Shell 100.00%

github-actions-deploy-1's Introduction

Deploy to a server with GitHub Actions

Requirements

  • SSH must be enabled in your server
  • You must have a GitHub repository (private for safety) created

How to use

If you follow all the steps below, when you git push to your GitHub repository, the GitHub Actions will deploy the modifications to your server.

  1. Choose a deployment folder
  2. Rename the deployment folder to .github and put it in your GitHub repository
  3. Setup the GitHub Actions secrets in your GitHub repository
  4. Clone your GitHub repository to your server. See this section to know how

Deployment folders

Folder name Description Usage recommendation
.github.blank Only deploys your modifications to your server, when you push to your GitHub repository Use this folder if you just want to deploy your modifications to your server
.github.laravel Besides deployment, it optmizes your Laravel files and enter in maintenance mode during the push Use this folder if you want to deploy to a Laravel application in your server

GitHub Actions secrets

Secret Description Example
REPOSITORY_PATH_IN_SERVER This is the path to the git repository in your server (where you cloned it) /home/username/repository/
SSH_HOST This is the SSH hostname to access your server website.com
SSH_PORT This is the SSH port number to access your server 1234
SSH_USERNAME This is the SSH username to access your server some_username
SSH_PASSWORD This is the SSH password to access your server some_password

Git clone your GitHub repository to your server

You have two choices to clone your GitHub repository to your server: HTTP or SSH.

Git clone via HTTP (recommended)

Enter your server terminal (via SSH or CPanel, for example) and go to the path you want to clone your GitHub repository.

Run the following command.

git clone https://username:[email protected]/username/repository.git

You must replace username with your GitHub username, token with your GitHub personal access token and repository with your GitHub repository name.

The reason why HTTP is recommended is because git usage in SSH can sometimes have issues with permissions.

Git clone via SSH

Enter your server terminal (via SSH or CPanel, for example) and go to the path you want to clone your GitHub repository.

Run the following command.

git clone [email protected]:username/repository.git

You must replace username with your GitHub username and repository with your GitHub repository name.

You also need to create a SSH key in your server and add it to GitHub. See this GitHub documentation page to know how.

github-actions-deploy-1's People

Contributors

willpinha 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.