Skip to content
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
50 changes: 50 additions & 0 deletions .github/workflows/doppler-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: doppler-check

on:
workflow_dispatch:

permissions:
contents: read

jobs:
validate:
name: Verifica variabili Doppler
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Verifica variabili GitHub
run: |
set -euo pipefail
echo "project: ${DOPPLER_PROJECT}"
echo "config: ${DOPPLER_CONFIG}"
if [ -z "${DOPPLER_PROJECT:-}" ]; then
echo "::error::DOPPLER_PROJECT non impostato"
exit 1
fi
if [ -z "${DOPPLER_CONFIG:-}" ]; then
echo "::error::DOPPLER_CONFIG non impostata"
exit 1
fi
if [ -z "${DOPPLER_TOKEN_PRESENT:-}" ]; then
echo "::warning::DOPPLER_TOKEN assente: il fetch non verrà eseguito."
fi
env:
DOPPLER_PROJECT: ${{ vars.DOPPLER_PROJECT }}
DOPPLER_CONFIG: ${{ vars.DOPPLER_CONFIG }}
DOPPLER_TOKEN_PRESENT: ${{ secrets.DOPPLER_TOKEN }}

- name: Fetch Doppler secrets
if: ${{ secrets.DOPPLER_TOKEN != '' && vars.DOPPLER_PROJECT != '' && vars.DOPPLER_CONFIG != '' }}
uses: dopplerhq/secrets-fetch-action@v2.0.0
with:
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
project: ${{ vars.DOPPLER_PROJECT }}
config: ${{ vars.DOPPLER_CONFIG }}
inject-env-vars: true

- name: Skip fetch
if: ${{ secrets.DOPPLER_TOKEN == '' || vars.DOPPLER_PROJECT == '' || vars.DOPPLER_CONFIG == '' }}
run: |
echo "::notice::Doppler fetch saltato: imposta DOPPLER_TOKEN, DOPPLER_PROJECT e DOPPLER_CONFIG nelle impostazioni GitHub."
26 changes: 26 additions & 0 deletions .github/workflows/sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,32 @@ jobs:
echo "should_run=false" >> "$GITHUB_OUTPUT"
fi

- name: Verifica variabili Doppler
if: github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true'
env:
DOPPLER_PROJECT: ${{ vars.DOPPLER_PROJECT }}
DOPPLER_CONFIG: ${{ vars.DOPPLER_CONFIG }}
DOPPLER_TOKEN_PRESENT: ${{ secrets.DOPPLER_TOKEN }}
run: |
if [ -z "${DOPPLER_PROJECT:-}" ]; then
echo "::warning::DOPPLER_PROJECT non impostato"
fi
if [ -z "${DOPPLER_CONFIG:-}" ]; then
echo "::warning::DOPPLER_CONFIG non impostata"
fi
if [ -z "${DOPPLER_TOKEN_PRESENT:-}" ]; then
echo "::notice::DOPPLER_TOKEN assente: il fetch non verrà eseguito."
fi

- name: Fetch secrets from Doppler
if: ${{ secrets.DOPPLER_TOKEN != '' && vars.DOPPLER_PROJECT != '' && vars.DOPPLER_CONFIG != '' && (github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true') }}
uses: dopplerhq/secrets-fetch-action@v2.0.0
with:
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
project: ${{ vars.DOPPLER_PROJECT }}
config: ${{ vars.DOPPLER_CONFIG }}
inject-env-vars: true

- name: Check email secrets
if: github.event_name != 'schedule' || steps.schedule.outputs.should_run == 'true'
env:
Expand Down
35 changes: 35 additions & 0 deletions docs/doppler-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Integrazione Doppler

## Obiettivo
Questo progetto è pronto per l'iniezione dei segreti da Doppler in CI/ambiente runtime.

## Configurazione GitHub richiesta
1. Crea in Doppler un Project con nome uguale al valore in `DOPPLER_PROJECT`.
2. Crea in quel project la Config da usare in CI (consigliata: `production`) e assegna i segreti nel modo abituale.
3. Crea un Service Token **read-only** per GitHub Actions (`token type: service token`), scope al config corretto.
4. Configura questi segreti/variabili nel repository:
- Secret: `DOPPLER_TOKEN`
- Variable: `DOPPLER_PROJECT`
- Variable: `DOPPLER_CONFIG`

## Stato attuale repo
- `DOPPLER_PROJECT` impostato a: `Sentinel`
- `DOPPLER_CONFIG` impostato a: `production`

## Workflow pronto
È stato aggiunto `.github/workflows/doppler-check.yml`.

### Come usarlo
- Apri la pagina *Actions* della repo e lancia manualmente `doppler-check`.
- Se `DOPPLER_TOKEN`, `DOPPLER_PROJECT` e `DOPPLER_CONFIG` sono corretti, il workflow prova il fetch dei segreti Doppler.

## Comandi GitHub (facoltativi)

```bash
gh variable set DOPPLER_PROJECT --body "Sentinel" --repo max23468/Sentinel
gh variable set DOPPLER_CONFIG --body "production" --repo max23468/Sentinel

gh secret set DOPPLER_TOKEN --body "<service_token_read_only>" --repo max23468/Sentinel
```

Sostituisci `<service_token_read_only>` con il token reale del Service Token Doppler.