update workflow

This commit is contained in:
lollerfirst
2025-08-24 15:24:02 +02:00
parent 73d0a526c0
commit e706e2893a
2 changed files with 76 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
name: Update Relay Data
on:
schedule:
# Run every day at 6:00 AM UTC
- cron: '0 6 * * *'
workflow_dispatch: # Allows manual triggering
push:
branches:
- main
paths:
- 'nostr_relay_discovery.py'
- 'filter_bitchat_relays.sh'
- 'relays_geo_lookup.sh'
jobs:
update-relay-data:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Make scripts executable
run: |
chmod +x filter_bitchat_relays.sh
chmod +x relays_geo_lookup.sh
- name: Update relay discovery results
run: |
python3 nostr_relay_discovery.py wss://relay.damus.io --output relay_discovery_results.json
- name: Update relay geolocation data
run: |
cat relay_discovery_results.json | jq .functioning_relays[] | ./filter_bitchat_relays.sh | sed 's|^wss://||' | ./relays_geo_lookup.sh nostr_relays.csv
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add relay_discovery_results.json nostr_relays.csv
git commit -m "Automated update of relay data - $(date -u)"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload relay data as artifacts
uses: actions/upload-artifact@v3
with:
name: relay-data-${{ github.run_number }}
path: |
relay_discovery_results.json
nostr_relays.csv
retention-days: 30