Skip to content

Commit

Permalink
Merge pull request #185 from HarborWallet/env-stuff
Browse files Browse the repository at this point in the history
make sure env secrets are set
  • Loading branch information
futurepaul authored Feb 13, 2025
2 parents 8a24c0d + b37e726 commit f4ae141
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}
MACOS_NOTARIZATION_PWD: ${{ secrets.MACOS_NOTARIZATION_PWD }}
run: nix develop --command bash -c "bash scripts/sign-macos.sh"
run: nix develop --command bash -c "scripts/sign-macos.sh"

- name: Package DMG
run: nix develop --command bash -c "${{ matrix.target.package }}"
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/test-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Test Secrets"

on:
workflow_dispatch: # Allow manual triggering

permissions:
contents: read

jobs:
test-secrets:
name: Test Secrets Access
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Make script executable
run: chmod +x scripts/test-secrets.sh

- name: Test Secrets
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
run: nix develop --command bash -c "./scripts/test-secrets.sh"
37 changes: 37 additions & 0 deletions scripts/test-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -e # Exit on error

# Source the environment variables if .env exists
if [ -f ".env" ]; then
set -a # automatically export all variables
source .env
set +a
fi

# Debug: Print shell information
echo "Shell: $SHELL"
echo "Bash Version: $BASH_VERSION"

# Script to test access to GitHub secrets
echo "Testing access to GitHub secrets..."

# Check required environment variables
environment=(
"MACOS_CERTIFICATE"
"MACOS_CERTIFICATE_PWD"
"MACOS_CERTIFICATE_NAME"
)

for var in "${environment[@]}"; do
if [[ -z "${!var}" ]]; then
echo "❌ Error: $var is not set"
exit 1
else
echo "$var is set"
# Print first character of the secret if it exists (for safety)
echo "$var starts with: ${!var:0:1}"
fi
done

echo "✨ Secret test complete!"

0 comments on commit f4ae141

Please sign in to comment.