Your issue seems similar to this one
Summarizing:
GitHub Actions is basically a container that runs commands, you can define your key as a secret on your project and then importing it in your Github Action workflow
Here are the steps that could be used on a project to publish the generated artifacts to Sonatype's repository:
- On a terminal window, you can search for the key ID by e-mail:
gpg --list-secret-keys user@example.com
- Export your key as Base64:
gpg --export-secret-keys YOUR_ID_HERE | base64 > private.key
- In your Github project, create a new Secret named GPG_SECRET_KEY (for example) and paste the Base64 content of your key (here is a reference how to do it)
- In your workflow
.yml
file, include a step to import the key from your just defined secret like the example below:
- name: Configure GPG Key
run: |
mkdir -p ~/.gnupg/
printf "$GPG_SIGNING_KEY" | base64 --decode > ~/.gnupg/private.key
gpg --import ~/.gnupg/private.key
env:
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
Note: Your GPG Key can't be protected by a password.