goreleaser / goreleaser-action

GitHub Action for GoReleaser
https://github.com/marketplace/actions/goreleaser-action
MIT License
833 stars 73 forks source link

Cannot use SSH private key secret as it is being treated as filename #440

Closed lukasmalkmus closed 8 months ago

lukasmalkmus commented 8 months ago

I'm trying to release to AUR.

.goreleaser.yaml uses the SSH private key like this:

private_key: "{{ .Env.AUR_KEY }}"

My workflow looks something like this:

- uses: goreleaser/goreleaser-action@v5
  with:
    args: release
  env:
    GITHUB_TOKEN: ${{ github.token }}
    HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
    AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}

However, the actions error with this message from GoReleaser:

* arch user repositories: git: could not stat private_key: stat ***

It looks like the SSH private key is being treated as a filename?

caarlos0 commented 8 months ago

it first tries to parse the private key, if that fails, it sees if it's a path to a file.

so probably the AUR_KEY is invalid.

error message could be better though.

lukasmalkmus commented 8 months ago

I started from scratch and it worked. I noticed that copying my ssh private key from 1PW removed the line breaks and I probably pasted that into the action secret.

Without looking I suspect you are using encoding/pem to parse the private key? Maybe that package fails if the - let me call it "block format" - is not correct and without line breaks?

Anyways, thanks for the heads up and sorry for the noise!