From c39527c841b0c79d5846adb6aeef05ffbd9b34eb Mon Sep 17 00:00:00 2001 From: Mark Sinclair Date: Tue, 21 Jun 2022 17:04:46 +0100 Subject: [PATCH] GitHub Actions: generate wallet .env from base64 string --- .github/workflows/nym-wallet-publish-macos.yml | 7 ++++--- .github/workflows/nym-wallet-publish-ubuntu.yml | 8 +++++--- .github/workflows/nym-wallet-publish-windows10.yml | 12 ++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nym-wallet-publish-macos.yml b/.github/workflows/nym-wallet-publish-macos.yml index 4ddffca9f5..d7a3a88002 100644 --- a/.github/workflows/nym-wallet-publish-macos.yml +++ b/.github/workflows/nym-wallet-publish-macos.yml @@ -57,9 +57,10 @@ jobs: security list-keychain -d user -s $KEYCHAIN_PATH - name: Create env file - run: | - touch .env - echo ADMIN_ADDRESS="${{ secrets.WALLET_ADMIN_ADDRESS }}" >> .env + uses: timheuer/base64-to-file@v1.1 + with: + fileName: '.env' + encodedString: ${{ secrets.WALLET_ADMIN_ADDRESS }} - name: Install app dependencies and build it env: diff --git a/.github/workflows/nym-wallet-publish-ubuntu.yml b/.github/workflows/nym-wallet-publish-ubuntu.yml index fab10aa823..46ed4be076 100644 --- a/.github/workflows/nym-wallet-publish-ubuntu.yml +++ b/.github/workflows/nym-wallet-publish-ubuntu.yml @@ -40,9 +40,11 @@ jobs: - name: Install app dependencies run: yarn - name: Create env file - run: | - touch .env - echo ADMIN_ADDRESS="${{ secrets.WALLET_ADMIN_ADDRESS }}" >> .env + uses: timheuer/base64-to-file@v1.1 + with: + fileName: '.env' + encodedString: ${{ secrets.WALLET_ADMIN_ADDRESS }} + - name: Build app run: yarn build env: diff --git a/.github/workflows/nym-wallet-publish-windows10.yml b/.github/workflows/nym-wallet-publish-windows10.yml index 0791206fdd..7ba342dd86 100644 --- a/.github/workflows/nym-wallet-publish-windows10.yml +++ b/.github/workflows/nym-wallet-publish-windows10.yml @@ -56,8 +56,16 @@ jobs: - name: Create env file run: | - touch .env - echo ADMIN_ADDRESS="${{ secrets.WALLET_ADMIN_ADDRESS }}" >> .env + $secretFile = Join-Path -Path $env:RUNNER_TEMP -ChildPath ".env"; + $encodedBytes = [System.Convert]::FromBase64String($env:DOT_ENV_DATA_BASE64); + Set-Content $secretFile -Value $encodedBytes -AsByteStream; + $secretFileHash = Get-FileHash $secretFile; + Write-Output "::set-output name=SECRET_FILE::$secretFile"; + Write-Output "::set-output name=SECRET_FILE_HASH::$($secretFileHash.Hash)"; + Write-Output "Secret file $secretFile has hash $($secretFileHash.Hash)"; + shell: pwsh + env: + DOT_ENV_DATA_BASE64: ${{ secrets.WALLET_ADMIN_ADDRESS }} - name: Install app dependencies run: yarn