/action-deploy-frappe

Primary LanguageShellMIT LicenseMIT

This action is a part of GitHub Actions Library created by rtCamp.

Deploy Frappe App - GitHub Action

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

A GitHub Action to deploy Frappe app on a server

Usage

  1. Create a .github/workflows/deploy.yml file in your GitHub repo, if one doesn't exist already.
  2. Add the following code to the deploy.yml file.
on: 
  push:
    branches:
      - main
      - staging

name: Deploying Frappe Site
jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Deploy
        uses: rtcamp/action-deploy-frappe@main
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
  1. Create SSH_PRIVATE_KEY secret using GitHub Action's Secret and store the private key that you use use to ssh to server(s) defined in hosts.yml.

  2. Create .github/hosts.yml inventory file, based on

main:
  hostname: production.com 
  user: frappe
  site_name: production-site.com
  deploy_path: /home/frappe/production

staging:
  hostname: staging.com 
  user: frappe
  site_name: staging-site.com
  deploy_path: /home/frappe/staging

Make sure you explictly define GitHub branch mapping. Only the GitHub branches mapped in hosts.yml will be deployed, rest will be filtered out.

hosts.yml Variables

  • All of these variables are mandatory.
Variable Possible Values Purpose
hostname ip or DNS FQDN hostname for ssh.
user valid username Username for ssh.
site_name site name Frappe Site Name for app installation.
deploy_path path Bench path.

Environment Variables

This GitHub action's behavior can be customized using following environment variables:

Variable Default Possible Values Purpose
FRAPPE_BRANCH version-14 Valid Frappe Branch Frappe branch. If not specified, default branch version-14 will be used.

Overriding default deployement behavior

If you need to modify the main.sh shell script of this action, you can create a file at location .github/deploy/addon.sh in your git repository. Checkout the example addon.sh to see how to customize.

Limitations

  • Only supports one site per bench.

License

MIT © 2023 rtCamp

Does this interest you?

Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions