Check Certificate Statuses #3414
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Certificate Statuses | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**/NexStore/**' | |
| - '.github/workflows/nexstore-build.yml' | |
| jobs: | |
| check-certificates: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests beautifulsoup4 lxml | |
| - name: Install NexStore refresh dependencies | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y curl jq wget tar python3 coreutils unzip zip \ | |
| libminizip1 libminizip-dev zlib1g | |
| - name: Normalize p12 passwords to NovaCerts | |
| run: | | |
| set -euo pipefail | |
| find . -type f -name "password.txt" -print0 | while IFS= read -r -d '' passfile; do | |
| dir="$(dirname "$passfile")" | |
| current_pass="$(tr -d '\r\n' < "$passfile")" | |
| if [ "$current_pass" = "NovaCerts" ]; then | |
| echo "✔ Already NovaCerts: $dir" | |
| continue | |
| fi | |
| mapfile -t p12s < <(find "$dir" -maxdepth 1 -name "*.p12") | |
| if [ "${#p12s[@]}" -eq 0 ]; then | |
| echo "⚠ No .p12 found in $dir" | |
| continue | |
| fi | |
| for p12_file in "${p12s[@]}"; do | |
| echo "🔁 Updating password for $p12_file" | |
| pem_file="$dir/temp.pem" | |
| new_p12="$dir/temp.p12" | |
| openssl pkcs12 \ | |
| -legacy \ | |
| -in "$p12_file" \ | |
| -out "$pem_file" \ | |
| -nodes \ | |
| -passin pass:"$current_pass" | |
| openssl pkcs12 \ | |
| -export \ | |
| -in "$pem_file" \ | |
| -out "$new_p12" \ | |
| -passout "pass:NovaCerts" | |
| mv "$new_p12" "$p12_file" | |
| rm -f "$pem_file" | |
| done | |
| echo "NovaCerts" > "$passfile" | |
| echo "✅ Updated passwords in $dir" | |
| done | |
| - name: Check certificate statuses | |
| run: | | |
| python scripts/check_certificates.py | |
| - name: Refresh outdated NexStore IPAs | |
| run: | | |
| bash scripts/build_nexstore_folders.sh | |
| - name: Commit & Push changes safely | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "📝 Update certificate statuses [$(date +'%Y-%m-%d %H:%M')]" | |
| # 🔥 Pull latest changes BEFORE pushing | |
| git pull origin main --rebase -X ours | |
| # 🚀 Push safely | |
| git push origin main |