Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure env secrets are set #185

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!"