Skip to content

gunalirezqimauludi/github-actions-training

Repository files navigation

GitHub Actions Training

GitHub CI/CD Service - Deploy To Shared Hosting With Github Actions

  1. Create a GitHub workflow file;

    mkdir .github
    mkdir .github/worflows
    touch main.yml
  2. Inside the file paste the updated steps for Get Latest Code & Sync Files

    name: ๐Ÿš€ Deploy website on push
    
    on:
    push:
       branches: [ main ]
    
    jobs:
    web-deploy:
       name: ๐ŸŽ‰ Deploy
       runs-on: ubuntu-latest
       steps:
       - name: ๐Ÿšš Get latest code
          uses: actions/checkout@v2
       - name: ๐Ÿ“‚ Sync files
          uses: burnett01/rsync-deployments@4.1
          with:
          switches: -avzr --delete --exclude="" --include="" --filter=""
          path: /
          remote_path: ${{ secrets.REMOTE_PATH }}
          remote_host: ${{ secrets.REMOTE_HOST }}
          remote_port: ${{ secrets.REMOTE_PORT }}
          remote_user: ${{ secrets.REMOTE_USER }}
          remote_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
  3. Create a SSH keys on this folder

    ssh-keygen -t rsa -b 4096 -C username@hostname
  4. When it promted for Enter file in which to save the key change the name of the file, e.g: repo-name

    $ Generating public/private rsa key pair.
    $ Enter file in which to save the key (/Users/gunalirezqi/.ssh/id_rsa): repo-name
    $ Enter passphrase (empty for no passphrase):
    $ Enter same passphrase again:
  5. Copy secret SSK key:

    cat repo-name | pbcopy
  6. Create a REMOTE_PRIVATE_KEY GitHub secret on your repo: Settings > Secrets > New secret and paste the secret SSH key

  7. Copy public SSK key

    cat repo-name.pub | pbcopy
  8. Create a deploy key on your GitHub repo: Settings > Deploy keys > Add deploy key and paste the public secret key

  9. ๐Ÿš€

About

๐Ÿ”„ GitHub CI/CD Service - Deploy To Shared Hosting With Github Actions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages