Today I Learned - Rocky Kev

TIL Github workflows

POSTED ON:

TAGS:

Automate deployment.

Issue: You have a ftp site. You also have Github. You wish that every time you push to master, the files on your production server get updated via FTP. (Note, there is a different setup if you have a SFTP setup.)

Solution:
This workflow will set that up for you:

Credentials you'll need:

* ftp-server address
* ftp-username
* ftp-password

Actions:

1. Select the repository you want to add the action to
2. Select the Actions tab
3. Select Blank workflow file or Set up a workflow yourself, if you don't see these options manually create a yaml file Your_Project/.github/workflows/main.yml
4. Paste the example above into your yaml file and save
5. Now you need to add a key to the secrets section in your project. To add a secret go to the Settings tab in your project then select Secrets. Add a new Secret for ftp-password
6. Update your yaml file settings

Related TILs

Tagged:

TIL what is npm Script

Despite their high usage they are not particularly well optimized and add about 400ms of overhead. In this article we were able to bring that down to ~22ms.

TIL fancy methods to transform Javascript Objects

You can use Object.entries(), Object.keys(), Object.fromEntries()...

TIL how to hide your JS code

ONE THING TO NOTE: Encrypting a script is stronger than obfuscation, both methods are still not adequate to protect secret content. Honestly, I don't think it's worth it on a production site, and instead just go with pure server-side if you want security. But it's fascinating.