58 lines
2.3 KiB
YAML
58 lines
2.3 KiB
YAML
name: List Infisical Secrets
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
list-secrets:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Force DNS resolution
|
|
run: |
|
|
# Install dnsutils to get the 'dig' command
|
|
sudo apt-get update && sudo apt-get install -y dnsutils
|
|
|
|
# Dynamically fetch the public IP to handle dynamic DNS
|
|
# We query Cloudflare DNS (1.1.1.1) to ignore local/Tailscale records
|
|
PUBLIC_IP=$(dig +short @1.1.1.1 infisical.lemarechal.eu | tail -n1)
|
|
echo "Public IP found: $PUBLIC_IP"
|
|
echo "$PUBLIC_IP infisical.lemarechal.eu" | sudo tee -a /etc/hosts
|
|
|
|
- name: Verify Secret Presence
|
|
env:
|
|
CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
run: |
|
|
echo "Checking secrets length (to avoid revealing them)..."
|
|
if [ -z "$CLIENT_ID" ]; then echo "❌ CLIENT_ID is EMPTY"; else echo "✅ CLIENT_ID length: ${#CLIENT_ID}"; fi
|
|
if [ -z "$CLIENT_SECRET" ]; then echo "❌ CLIENT_SECRET is EMPTY"; else echo "✅ CLIENT_SECRET length: ${#CLIENT_SECRET}"; fi
|
|
|
|
- name: Debug Authentication (curl)
|
|
env:
|
|
CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
run: |
|
|
echo "Testing authentication endpoint..."
|
|
# Use -s to be silent and -S to show errors, then pipe to cat to see the body
|
|
RESPONSE=$(curl -s -S -X POST https://infisical.lemarechal.eu/api/v1/auth/universal-auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"clientId\": \"$CLIENT_ID\", \"clientSecret\": \"$CLIENT_SECRET\"}")
|
|
echo "API Response: $RESPONSE"
|
|
|
|
- name: Fetch Secrets from Infisical
|
|
uses: https://github.com/Infisical/secrets-action@v1.0.7
|
|
with:
|
|
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
project-id: ${{ secrets.INFISICAL_PROJECT_ID }}
|
|
env-slug: prod
|
|
secret-path: /Discord_bot
|
|
domain: https://infisical.lemarechal.eu
|
|
|
|
- name: Display Secrets
|
|
run: |
|
|
echo "Secrets fetched and injected as environment variables."
|
|
env | grep -v "GITHUB_" | grep -v "GITEA_" | sort
|