notepad-plus-plus / npp-usermanual

Notepad++ User Manual

Home Page:https://npp-user-manual.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub action to do Deployment for you

pryrt opened this issue · comments

@donho,

What do you think about having a GitHub action that would perform the "deployment" (publishing to the website) for you? We could set it up so that it automatically publishes any time a Tag is made. This would mean that I wouldn't have to keep pestering you every time the manual is ready for the next release, freeing up more of your time for focusing on other things. :-)

Details
With using SSH keys stored in encrypted GitHub variables, a GitHub action would be able to copy the bundle to the npp-user-manual.org host machine, and run the command to extract the new version into the correct directory on the server.

If you were okay with me pursuing this, the steps would be:

  1. You let me know what command(s) you use to unbundle, and what directory it goes into
  2. I would do experimental deployments to a machine I have access to, and set up the GitHub Action to work correctly
  3. I would then give you the instructions I'd figured out for correctly creating and storing the SSH key, so that you could do that part
  4. From then on, I should be able to trigger a Tag here, and have it automatically publish the User Manual for us.

If you aren't comfortable with automating that, I understand, and I'll just keep pestering you every once in a while to manually do the next User Manual release. :-)

commented

@pryrt
It sounds interesting. But some points are not clear to me.

The procedure for the moment is:

  1. You assign me a job via GitHub, then I sync my local master from the one of GitHub.
  2. I increase the version, and tag a release on GitHub.
  3. I generate whole site into HTML from Markdown locally.
  4. I login (with password) into Npp User Manual host server via FTP, and copy the generated content.

Could you provide the procedure/schema of the automatic deployment please?

@donho,

Based on that description of the current procedure, the modified procedure would be:

  1. One of the User Manual Admin team (usually me) will increase the version and tag a release on GitHub
  2. GitHub action ("GHA") will run because of the tag
    1. GHA will generate the HTML from the Markdown
    2. GHA would login to the Npp User Manual host server using SFTP and an SSH key (which is stored in a protected GitHub variable, so that no outsiders can read or use the key), and copy the generated content

update: it can actually be either through an SSH key or through password. And I just confirmed that when I created a "secret" variable in a GitHub repo, I can go and set a new value, but even I as the one who created it cannot see the old value. So if we go that route, you'll be able to create the secret variables and the GHA will be able to use them, but not even you or I would be able to see them.

commented

Using GH's private & public pair key might be good.
However, for login SSH, GH needs rather public key generated from the host of Npp User Manual site, right?

I believe it's actually the other way around, because it's GH trying to access the usermanual server, so GH gets the private key and the usermanual server gets the public key. But if you want to go down this route, I will experiment with a remote server that I have credentials for, and will figure out where each key goes for the setup to work. When I know everything is working, I can give the right steps for which part of the key you need to put where. (For making sure I'm replicating things correctly, it would be useful to know what directory the HTML files go into on the usermanual server.)

commented

because it's GH trying to access the usermanual server, so GH gets the private key and the usermanual server gets the public key.

Oups, you're right.
OK, we can try at least.
Please let me know what you need.