Fetch Prometheus Grafana Versions #37
This file contains 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: Fetch Prometheus Grafana Versions | |
on: | |
schedule: | |
- cron: '* * * * *' # Runs at 00:00, on day 1 of the month, only in January, April, July, and October. | |
jobs: | |
fetch_promgraf_versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Fetch Latest Prometheus Version | |
run: | | |
PROM_V_LATEST_VERSION=$(curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') | |
PROM_LATEST_VERSION=$(echo "${PROM_V_LATEST_VERSION}" | cut -c 2-) | |
echo "Latest Prometheus Version: ${PROM_LATEST_VERSION}" | |
sed -i " 4 c LATEST_VERSION=${PROM_LATEST_VERSION} " prometheus.sh | |
- name: Commit updated prometheus versions | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "actions@github.com" | |
git add prometheus.sh | |
if ! git diff --cached --quiet; then | |
echo "Promethus version differs, updating promethus.sh..." | |
git commit -m "Update Promethus.sh file" | |
git push | |
else | |
echo "No changes detected, skipping commit." | |
fi | |
- name: Fetch Latest Grafana Version | |
run: | | |
GRAF_V_LATEST_VERSION=$(curl -s https://api.github.com/repos/grafana/grafana/releases/latest | jq -r '.tag_name') | |
GRAF_LATEST_VERSION=$(echo "${GRAF_V_LATEST_VERSION}" | cut -c 2-) | |
echo "Latest Grafana Version: ${GRAF_LATEST_VERSION}" | |
sed -i " 5 c LATEST_VERSION=${GRAF_LATEST_VERSION} " grafana.sh | |
- name: Commit updated grafana versions | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "actions@github.com" | |
git add grafana.sh | |
if ! git diff --cached --quiet; then | |
echo "Grafana version differs, updating gragana.sh..." | |
git commit -m "Update Grafana.sh file" | |
git push | |
else | |
echo "No changes detected, skipping commit." | |
fi | |
- name: Fetch Latest Note Exporter Version | |
run: | | |
latest_version=$(curl -s https://api.github.com/repos/prometheus/node_exporter/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') | |
node_latest_version=$(echo "${latest_version}" | cut -c 2-) | |
echo "Fetched Latest Node Exporter Version: ${node_latest_version}" | |
sed -i " 4 c LATEST_VERSION=${node_latest_version}" node_exporter.sh | |
- name: Commit updated node exporter versions | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "actions@github.com" | |
git add node_exporter.sh | |
if ! git diff --cached --quiet; then | |
echo "Node Exporter version differs, updating node_exporter.sh..." | |
git commit -m "Update Node_Exporter.sh file" | |
git push | |
else | |
echo "No changes detected, skipping commit." | |
fi |