File: gh-metrics-push.sh

package info (click to toggle)
prometheus-postgres-exporter 0.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 900 kB
  • sloc: sh: 374; makefile: 54
file content (29 lines) | stat: -rwxr-xr-x 697 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Script to copy and push new metric versions to the assets branch.

[ ! -z "$GIT_ASSETS_BRANCH" ] || exit 1
[ ! -z "$GIT_API_KEY" ] || exit 1

version=$(git describe HEAD) || exit 1

# Constants
ASSETS_DIR=".assets-branch"
METRICS_DIR="$ASSETS_DIR/metriclists"

# Ensure metrics dir exists
mkdir -p "$METRICS_DIR/"

# Remove old files so we spot deletions
rm -f "$METRICS_DIR/.*.unique"

# Copy new files
cp -f -t "$METRICS_DIR/" ./.metrics.*.prom.unique || exit 1

# Enter the assets dir and push.
cd "$ASSETS_DIR" || exit 1

git add "metriclists" || exit 1
git commit -m "Added unique metrics for build from $version" || exit 1
git push origin "$GIT_ASSETS_BRANCH" || exit 1

exit 0