diff --git a/.github/workflows/nightly_check.yml b/.github/workflows/nightly_check.yml index 3125fed..bc4a815 100644 --- a/.github/workflows/nightly_check.yml +++ b/.github/workflows/nightly_check.yml @@ -1,76 +1,80 @@ -name: Nightly Release +name: Nightly Data Update on: schedule: # 03:00 UTC ogni giorno - - cron: "0 3 * * *" + - cron: "0 2 * * *" # opzionale: permette lancio manuale workflow_dispatch: permissions: contents: write jobs: build-and-release: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | pip install -r requirements.txt - name: Run script id: check run: | python parse_gtfs.py + + - name: Inspect public_data + run: | + ls -la public_data - name: Commit versions.json if: steps.check.outputs.changed == 'true' run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add public_data/versions.json # evita errore se non ci sono modifiche git diff --cached --quiet || git commit -m "Update versions.json" git push - name: Generate release tag id: tag if: steps.check.outputs.changed == 'true' run: | TAG="data-$(date +'%Y%m%d')" echo "tag=$TAG" >> $GITHUB_OUTPUT - name: Create Release uses: softprops/action-gh-release@v2 if: steps.check.outputs.changed == 'true' with: tag_name: ${{ steps.tag.outputs.tag }} name: Daily Release ${{ steps.tag.outputs.tag }} files: | public_data/versions.json public_data/*.txt.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Cleanup old releases if: steps.check.outputs.changed == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release list --limit 100 --json tagName \ | jq -r '.[10:] | .[].tagName' \ | xargs -I {} sh -c 'gh release delete {} --yes --cleanup-tag' \ No newline at end of file