🚀 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. ⏳🚀