Update AltStore Source #317
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update AltStore Source | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run daily at midnight UTC | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
update-source: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Record job start time | |
id: job_start_time | |
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT | |
- name: Update AltStore source | |
id: update_source | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python update_json.py | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git add apps.json | |
if git diff --staged --quiet; then | |
echo "changes=false" >> $GITHUB_OUTPUT | |
else | |
git commit -m "Updated source with latest release" | |
git push | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Calculate job duration | |
id: duration | |
if: always() | |
run: | | |
end_time=$(date +%s) | |
duration=$((end_time - ${{ steps.job_start_time.outputs.start_time }})) | |
echo "duration=$duration seconds" >> $GITHUB_OUTPUT | |
- name: Create job summary | |
run: | | |
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then | |
echo "## Update Altstore Source Summary π" >> $GITHUB_STEP_SUMMARY | |
echo "β Changes Detected and Applied" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "The apps.json file has been updated with the latest release information." >> $GITHUB_STEP_SUMMARY | |
else | |
echo "## Update Altstore Source Summary π" >> $GITHUB_STEP_SUMMARY | |
echo "π No Changes Detected" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "The apps.json file is up to date. No changes were necessary." >> $GITHUB_STEP_SUMMARY | |
fi | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "π Execution Time" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "This job took ${{ steps.duration.outputs.duration }} to complete." >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "π Next Scheduled Run" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "The next scheduled run will be tomorrow at midnight UTC." >> $GITHUB_STEP_SUMMARY |