Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glorious hack to fix publishing key import on macOS runners #648

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,15 @@ jobs:
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: echo $PGP_SECRET | base64 -di | gpg --import
run: echo $PGP_SECRET | base64 -d -i - | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ object TypelevelCiSigningPlugin extends AutoPlugin {

override def buildSettings = Seq(
githubWorkflowPublishPreamble := Seq(
// The command below is supported but interpreted differently on Linux and macOS runners.
// Linux: base64 --decode --ignore-garbage -
// macOS: base64 --decode --input -
// On Linux, the `-` is a positional argument, on macOS it is the parameter to `--input`.
WorkflowStep.Run( // if your key is not passphrase-protected
List("echo $PGP_SECRET | base64 -di | gpg --import"),
List("echo $PGP_SECRET | base64 -d -i - | gpg --import"),
name = Some("Import signing key"),
cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''"),
env = env
),
WorkflowStep.Run( // if your key is passphrase-protected
List(
"echo \"$PGP_SECRET\" | base64 -di > /tmp/signing-key.gpg",
"echo \"$PGP_SECRET\" | base64 -d -i - > /tmp/signing-key.gpg",
"echo \"$PGP_PASSPHRASE\" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg",
"(echo \"$PGP_PASSPHRASE\"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)"
),
Expand Down