Skip to content

Update Library and create manifest #43

Update Library and create manifest

Update Library and create manifest #43

name: Update Library and create manifest
on:
schedule:
- cron: '0 6 * * 5' # מפעיל את ה-Workflow כל יום שישי בשעה 8:00 שעון ישראל (3:00 UTC)
workflow_dispatch: # מאפשר הפעלה ידנית
# שמירת הטריגר הישן כתגובה כדי שלא יפעל בפועל
# on:
# push:
# branches:
# - main
# - master
# paths:
# - Ben-YehudaToOtzaria/ספרים/אוצריא/**
# - DictaToOtzaria/ספרים/ערוך/אוצריא/**
# - OnYourWayToOtzaria/ספרים/אוצריא/**
# - OraytaToOtzaria/ספרים/אוצריא/**
# - sefariaToOtzaria/ספרים/אוצריא/**
# - sefaria and more/**
jobs:
update-manifest:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]' && github.actor != 'github-actions'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install bs4 requests pyluach
- name: Sync files and folders
run: |
python sync_and_merge_folders.py
- name: Generate Files Manifest
run: |
echo "{" > files_manifest.json
find . \( -path "./metadata.json" -o -path "./אוצריא/*" -o -path "./links/*" \) -type f \
! -path "./.git/*" \
! -path "./.github/*" \
! -name "files_manifest.json" \
-exec sh -c '
path="${1#./}"
hash=$(sha256sum "$1" | cut -d" " -f1)
echo "\"$path\": {\"hash\": \"$hash\"}"
' sh {} \; | sed "$ ! s/$/,/" >> files_manifest.json
echo "}" >> files_manifest.json
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "Update files manifest and sync folders"
default_author: github_actions
- name: update in mitmachim
env:
USER_NAME: ${{ secrets.USER_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
TOKEN_YEMOT: ${{ secrets.TOKEN_YEMOT }}
run: |
python send_update/main.py
- name: Create Release Archive
run: |
zip -r otzaria_latest.zip אוצריא links files_manifest.json metadata.json
- name: Delete existing 'latest' release and tag
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete latest --yes || true
git push --delete origin latest || true
- name: Create and push new tag # יצירת תגית חדשה
run: |
git tag -f latest
git push origin latest --force
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create latest \
--title "Latest Otzaria Files" \
--notes "Latest version of Otzaria files" \
otzaria_latest.zip