ci: inject .env files from Gitea variables during deploy
Run Tests on Branches / Detect Changes (push) Successful in 15s
Run Tests on Branches / Backend Tests (push) Successful in 2m31s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Successful in 2m24s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Detect Changes (push) Successful in 15s
Run Tests on Branches / Backend Tests (push) Successful in 2m31s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Successful in 2m24s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Replace the basic .env.example sync with a deploy script that fetches repo variables from the Gitea API and writes them to the correct .env files, preserving comments from .env.example templates.
This commit is contained in:
@@ -254,30 +254,16 @@ jobs:
|
||||
set -euo pipefail
|
||||
git pull
|
||||
|
||||
- name: Sync .env files from .env.example
|
||||
- name: Inject .env files from Gitea variables
|
||||
working-directory: /docker/FarmaFinder
|
||||
env:
|
||||
GITEA_TOKEN: ${{ vars.GITEA_TOKEN }}
|
||||
GITEA_OWNER: Ichitux
|
||||
GITEA_REPO: FarmaFinder
|
||||
WORK_DIR: /docker/FarmaFinder
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r env_example; do
|
||||
dir=$(dirname "$env_example")
|
||||
env_file="$dir/.env"
|
||||
|
||||
if [ ! -f "$env_file" ]; then
|
||||
cp "$env_example" "$env_file"
|
||||
echo "[env-sync] Created $env_file from $env_example"
|
||||
else
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
case "$line" in
|
||||
''|\#*) continue ;;
|
||||
esac
|
||||
key=$(echo "$line" | cut -d'=' -f1)
|
||||
if ! grep -qF "$key=" "$env_file"; then
|
||||
echo "$line" >> "$env_file"
|
||||
echo "[env-sync] Added missing key '$key' to $env_file"
|
||||
fi
|
||||
done < "$env_example"
|
||||
fi
|
||||
done < <(find apps -name ".env.example" -type f)
|
||||
bash scripts/deploy-env.sh
|
||||
|
||||
- name: Deploy containers
|
||||
working-directory: /docker/FarmaFinder
|
||||
|
||||
Reference in New Issue
Block a user