Github Process
How to setup a new Repo on github.com for SQRD Media
Prerequisites: - Need a Github account with access to SQRD Media's organization.
Steps to setting up a client Repo:
- Click the "+" icon in the top right corner and select "New repository".
- Make sure to select "SQRD Media" as the account owner.
- Name the Repo as close to the project url as you can example: "sqrdmedia.com"
- Enter a name for your repository and select "Private" under "Visibility".
- Add a read me file
- Prese Create Repository
At this point you now have a repo that can be pulled to your local dev environment.
Initial Commit ( Wordpress ): *Best to setup the repo with these steps before installing Wordpress*
- Setup a .gitignore file in the root of the repo and use the WP-Engine WP template found here.
- Add "node_modules" to the .gitignore file
- Push that to the repo
- You can now install WordPress using whatever method you find best for your localhost.
Auto Deploys to FTP:
- Create in the repo a file that is the same name as the main/master branch name in the folders "/.github/workflows/[mainbranchname].yml" without the brackets.
- Add the following to the file:
jsx name: Deploy to data.evcars.com on: push: branches: - master jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Install Node.js uses: actions/setup-node@v1 with: node-version: '10.x' - name: Deploy to Server uses: easingthemes/ssh-deploy@main env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} ARGS: "-rltgoDzvO" SOURCE: "" REMOTE_HOST: ${{ secrets.REMOTE_HOST }} REMOTE_USER: ${{ secrets.REMOTE_USER }} TARGET: ${{ secrets.REMOTE_TARGET }} EXCLUDE: "/dist/, /.git/, /.github/, /README.md, /node_modules/" - Change the name of the branch to the name of the branch you want it to listen for above.
- Inside Github go into the repo that you would like to create this deploy with.
- This method uses SSH and you’ll need a copy of your SSH Private key to access the server.
- In the Repo click settings
- click Secrets and variables
- Click actions
- Create a new repository secret for REMOTE_USER most cases this is "root"
- Create a new repository secret for REMOTE_TARGET with the file path to the site, in most cases it’s "/var/www/site.com/htdocs/"
- Create a new repository secret for REMOTE_HOST with the ip address of the server.
- Create a new repository secret for SSH_PRIVATE_KEY and copy your ssh key that is used to access the server with in there.
- Click actions
- click Secrets and variables
- Once step 5 is finished you should be able to push and then go to the actions tab in Github and watch Github deploy the code.
- If you run into an error google "easingthemes/ssh-deploy@main" and look at their docs.
- Other branches will need their own file, example: "develop.yml" with the branch name changed to develop.
Auto Deploys to WP-Engine:
- Create in the repo a file that is the same name as the main/master branch name in the folders "/.github/workflows/[mainbranchname].yml" without the brackets.
- Add the following to the file:
jsx name: Deploy to WP Engine on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: GitHub Action Deploy to WP Engine uses: wpengine/github-action-wpe-site-deploy@v3.0 with: WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }} WPE_ENV: evcarscom - Change the name of the branch to the name of the branch you want it to listen for above.
- Change the WPE_ENV var to the name WP-engine gives you.
- Inside Github go into the repo that you would like to create this deploy with.
- This method uses SSH and you’ll need a copy of your SSH Private key to access the server.
- In the Repo click settings
- click Secrets and variables
- Click actions
- Create a new repository secret for WPE_SSH_PRIVATE_KEY and copy your ssh key that is used to access your account in WP-Engine.
- Click actions
- click Secrets and variables
- Once step 5 is finished you should be able to push and then go to the actions tab in Github and watch Github deploy the code.
- If you run into an error google "wpengine/github-action-wpe-site-deploy@v3.0" and look at their docs.
- Other branches will need their own file, example: "develop.yml" with the branch name changed to develop.