This isn’t Rails-related or even Ruby-related, but I’m sure that at least one person in this group has experience with this.
I have a script that can automatically upload files to SourceForge. This requires pre-authentication, and this is done through SSH keys. The authentication procedure consists of these two steps:
- Generate a key through SSH on my local machine. (SourceForge Support / Documentation / SSH Keys)
- Paste the public key contents in my SSH settings on Sourceforge. (SourceForge Support / Documentation / SSH Keys)
What I’m trying to do is replace my local machine with GitHub Workflows. My questions:
- How do I generate my keys through SSH in GitHub Workflows?
- How do I view my public key in GitHub Workflows so that I can paste it in my SSH settings on SourceForge?
Hey @jhsu802701,
I recently did this!
- Store your key in that repository as an action secret. Settings → Secrets → Actions.
- Do a keyscan for the host that you’ll be connecting to and store that as an Action secret as well, I saved it in KNOWN_HOSTS for that repo.
ssh-keyscan -H github.com
for example.
- Add something similar to this right before you’re going to connect via SSH in your github workflow.
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
2 Likes
Thanks, Nick! I finally have things figured out, though my solution is slightly different. Check out what I did at GitHub - swiftlinux/remaster-mx21 .
I realize now that I had no clue how to use the secrets in GitHub Workflows. Now I understand.
Nice, glad that worked out for ya!