๐ 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)