Deploy Static Site with Github Actions

Dec 11, 2023
  1. on the remote webserver, create deploy user
    useradd -G www-data deploy -m -d /var/www/site/root
    
  1. on your local machine, create ssh key pair for deploy user

    ssh-keygen -t ed25519 -f ~/.ssh/deploy
    Generating public/private ed25519 key pair.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in ...
    Your public key has been saved in ...
    The key fingerprint is:
    ...
    The keys randomart image is:
    ...
    
  2. create .ssh directory in the deploy user home directory and copy public key into authorized_keys file mkdir /var/www/site/root/.ssh
    vim /var/www/site/root/.ssh/authoirized_keys

  3. set ownership and permissions on webserver

    sudo chown -R deploy:www-data /var/www/site/root
    sudo chmod 700 /var/www/site/root/.ssh
    sudo chmod 500 /var/www/site/root/.ssh/authorized_keys
    
  4. test ssh connection from local machine

  5. mkdir -pv .github/workflows in project root

  6. create ci.yml file

  7. create deploy environment on github project

  8. add environment secrets