Skip to content

Update GeoNames Data #5

Update GeoNames Data

Update GeoNames Data #5

name: Update GeoNames Data
on:
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight UTC
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
issues: write
pull-requests: write
jobs:
update-geonames:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- 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 httpx loguru tqdm
- name: Run update script
run: python update_allCountries.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check update status
id: check_update
run: |
UPDATE_STATUS=$(cat update_status.txt)
echo "UPDATE_STATUS=$UPDATE_STATUS" >> $GITHUB_OUTPUT
- name: Read release notes
id: release_notes
run: |
RELEASE_NOTES=$(cat release_notes.txt)
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Read release title
id: release_title
run: echo "RELEASE_TITLE=$(cat release_title.txt)" >> $GITHUB_OUTPUT
- name: Create Release
if: steps.check_update.outputs.UPDATE_STATUS == 'update'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}-${{ github.run_number }}
name: ${{ steps.release_title.outputs.RELEASE_TITLE }}
body: ${{ steps.release_notes.outputs.RELEASE_NOTES }}
files: allCountries.zip
draft: false
prerelease: false
- name: Upload release notes
uses: actions/upload-artifact@v4
with:
name: release-notes
path: release_notes.txt