Skip to content

Commit cbeee1e

Browse files
committed
ci(publish): improve secrets handling in publish workflow
Use environment variables for secrets and PowerShell cmdlets for file operations to ensure proper handling of special characters in keys
1 parent 31c0399 commit cbeee1e

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ jobs:
3232
3333
- name: Secrets
3434
shell: pwsh
35+
env:
36+
OFFICIAL_PUBLIC_KEY: ${{ secrets.OFFICIAL_PUBLIC_KEY }}
37+
OFFICIAL_PRIVATE_KEY: ${{ secrets.OFFICIAL_PRIVATE_KEY }}
3538
run: |
36-
echo 'public partial class Secrets { internal static readonly string Dsn ="${{ secrets.SENTRY_DSN }}"; internal static readonly string OfficialPublicKey = "${{ secrets.OFFICIAL_PUBLIC_KEY }}"; }' > src/Common/KeyAsio.Secrets/Secrets.cs
39+
$secretsContent = 'public partial class Secrets { internal static readonly string Dsn ="${{ secrets.SENTRY_DSN }}"; internal static readonly string OfficialPublicKey = @"' + $env:OFFICIAL_PUBLIC_KEY + '"; }'
40+
Set-Content -Path "src/Common/KeyAsio.Secrets/Secrets.cs" -Value $secretsContent
3741
38-
$privateKey = '${{ secrets.OFFICIAL_PRIVATE_KEY }}'
39-
if ($privateKey) {
40-
echo $privateKey > src/Apps/KeyAsio/keyasio_private.key
42+
if ($env:OFFICIAL_PRIVATE_KEY) {
43+
Set-Content -Path "src/Apps/KeyAsio/keyasio_private.key" -Value $env:OFFICIAL_PRIVATE_KEY
4144
}
4245
4346
- name: Publish

0 commit comments

Comments
 (0)