π I was working with GitHub Actions. I hadnβt explored it before, but I wanted to make my deployment process a bit smoother.
π The task wasnβt exactly deployment, it was more about sending updated files and folders to the server. Previously, I had to manually update the code on the server again and again, so I decided to automate the process using GitHub Actions.
π To create a workflow in GitHub Actions, you need to define all instructions in a .yml file. Since I hadnβt worked with YAML before, I asked ChatGPT π€ to generate the structure for me. It included server configurations and commands for copying the main branch to the server using rsync π.
π However, to make this work, you need SSH keys for authentication between GitHub and the server. At first, I was using them incorrectly π . For authentication, the public key π needs to be authorized on the server, and the private key π should be stored in the Secrets environment of the repository settings on GitHub. This way, GitHub acts as a client.
π‘ How SSH authentication works:
SSH essentially works with a pair of keys:
β Private key (secret key) β Must always be securely saved on the client (local server).
β Public key β Stored on the remote server.
π‘ When the client sends an access request to the remote server, the private key on the client creates a digital signature βοΈ. If this signature matches the public keyβs signature on the remote server, access is granted β .
In the end, I automated the transfer of project files between my GitHub repository and the server, saving me a lot of time. β³π
Top comments (0)