github-actions decode base64 string on windows

Viewed 2383

I have publishing job in github actions. It uses certificate which is stored in base64 format in repo secrets. I need to decode this certificate and store it on disk on windows-latest machine. My workflow looks like that

name: publish
on: [ push ]
jobs:
  build:
    runs-on: windows-latest
    steps:
      - name: checkout
        uses: actions/checkout@v2
      - run: echo "${{ secrets.WINDOWS_CERT}}" | base64 --decode > $HOME/certificate.pfx   
      - run: cat $HOME/certificate.pfx

When i run it i get error

Run echo "***" | base64 --decode > $HOME/certificate.pfx
  echo "***" | base64 --decode > $HOME/certificate.pfx
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
/usr/bin/base64: invalid input
##[error]Process completed with exit code 1.

How do i properly decode base64 encoded secrets on windows machines?

Thanks

0 Answers
Related