Open-source personal finance manager. Self-hosted, privacy-first.
adding downloads badge
Tássio Noronha2a1ad717daff
diff --git a/.github/workflows/downloads-badge.yml b/.github/workflows/downloads-badge.ymlnew file mode 100644index 00000000..89156d6f--- /dev/null+++ b/.github/workflows/downloads-badge.yml@@ -0,0 +1,47 @@+name: Downloads Badge++on:+ schedule:+ - cron: "17 5 * * *"+ workflow_dispatch:++jobs:+ update-badge:+ name: Update Downloads Badge+ runs-on: ubuntu-latest+ steps:+ - name: Fetch GHCR download counts+ id: downloads+ run: |+ count() {+ curl -sfL "https://github.com/securo-finance/securo/pkgs/container/$1" \+ | grep -A1 'Total downloads' \+ | grep -oE 'title="[0-9]+"' \+ | grep -oE '[0-9]+'+ }+ backend=$(count securo-backend)+ frontend=$(count securo-frontend)+ if [ -z "$backend" ] || [ -z "$frontend" ]; then+ echo "Failed to parse download counts (backend='$backend', frontend='$frontend')" >&2+ exit 1+ fi+ # Both images are required to run Securo, so the smaller count is+ # the closest proxy for real installs.+ min=$(( backend < frontend ? backend : frontend ))+ if [ "$min" -ge 1000 ]; then+ pretty=$(awk -v n="$min" 'BEGIN { printf "%.1fk", n / 1000 }')+ else+ pretty=$min+ fi+ echo "Backend: $backend, Frontend: $frontend, Badge: $pretty"+ echo "count=$pretty" >> "$GITHUB_OUTPUT"++ - name: Update gist badge+ uses: schneegans/[email protected]+ with:+ auth: ${{ secrets.GIST_TOKEN }}+ gistID: ae627b744aaa2ba89d850ea541c311be+ filename: downloads.json+ label: downloads+ message: ${{ steps.downloads.outputs.count }}+ color: bluediff --git a/README.md b/README.mdindex 73f0c36d..2716ebae 100644--- a/README.md+++ b/README.md@@ -5,6 +5,7 @@<p align="center"><a href="https://github.com/securo-finance/securo/actions/workflows/ci.yml"><img src="https://github.com/securo-finance/securo/actions/workflows/ci.yml/badge.svg" alt="CI" /></a><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tassionoronha/ae627b744aaa2ba89d850ea541c311be/raw/coverage.json" alt="Coverage" />+ <a href="https://github.com/securo-finance/securo/pkgs/container/securo-frontend"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tassionoronha/ae627b744aaa2ba89d850ea541c311be/raw/downloads.json" alt="Downloads" /></a><a href="https://www.gnu.org/licenses/agpl-3.0"><img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg" alt="License: AGPL-3.0" /></a><a href="https://discord.gg/rUqTKtQ9S4"><img src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white" alt="Join our Discord" /></a><br />