diff --git a/.github/workflows/nightly_check.yml b/.github/workflows/nightly_check.yml new file mode 100644 index 0000000..dbb200c --- /dev/null +++ b/.github/workflows/nightly_check.yml @@ -0,0 +1,63 @@ +name: Nightly Release + +on: + schedule: + # 03:00 UTC ogni giorno + - cron: "0 3 * * *" + + # 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" + + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Run script + run: | + python scripts/generate_data.py + + - name: Commit versions.json + 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 + run: | + TAG="daily-$(date +'%Y%m%d-%H%M')" + echo "tag=$TAG" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v2 + 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 }} \ No newline at end of file