mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 04:20:30 +00:00
125 lines
No EOL
4.6 KiB
YAML
125 lines
No EOL
4.6 KiB
YAML
name: Update StikJIT Source
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
# Add permissions block to ensure the workflow can push changes
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
update-source:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: main # Explicitly checkout the main branch
|
|
fetch-depth: 0 # Fetch all history for proper branching
|
|
|
|
- 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: Debug repository information
|
|
run: |
|
|
echo "Repository: $GITHUB_REPOSITORY"
|
|
echo "Event name: $GITHUB_EVENT_NAME"
|
|
echo "Event path: $GITHUB_EVENT_PATH"
|
|
if [ -f "$GITHUB_EVENT_PATH" ]; then
|
|
echo "Event payload:"
|
|
cat $GITHUB_EVENT_PATH
|
|
fi
|
|
echo "Current directory: $(pwd)"
|
|
echo "Repository contents:"
|
|
ls -la
|
|
|
|
- name: Update StikJIT 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 'action@github.com'
|
|
git add repo.json
|
|
if git diff --staged --quiet; then
|
|
echo "changes=false" >> $GITHUB_OUTPUT
|
|
echo "No changes detected in repo.json"
|
|
else
|
|
echo "Changes detected in repo.json:"
|
|
git diff --staged
|
|
# Create a new branch for the changes
|
|
BRANCH_NAME="update-source-$(date +%Y%m%d-%H%M%S)"
|
|
git checkout -b $BRANCH_NAME
|
|
git commit -m "Updated source with latest StikJIT release"
|
|
git push origin $BRANCH_NAME
|
|
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
|
echo "changes=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Create Pull Request
|
|
if: steps.update_source.outputs.changes == 'true'
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ steps.update_source.outputs.branch }}
|
|
base: main
|
|
title: "Update StikJIT source with latest release"
|
|
body: |
|
|
This PR updates the repo.json file with the latest StikJIT release information.
|
|
|
|
Changes include:
|
|
- Updated version information
|
|
- Added new release to versions list
|
|
- Updated news section
|
|
|
|
Please review and merge if everything looks good.
|
|
|
|
- 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 StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY
|
|
echo "✅ Changes Detected and Pull Request Created" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "A pull request has been created to update the repo.json file with the latest release information." >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY
|
|
echo "🔍 No Changes Detected" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "The repo.json file is up to date. No changes were necessary." >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "This could be because:" >> $GITHUB_STEP_SUMMARY
|
|
echo "- The release version is already in the repo.json file" >> $GITHUB_STEP_SUMMARY
|
|
echo "- The release doesn't contain an IPA file" >> $GITHUB_STEP_SUMMARY
|
|
echo "- The release tag doesn't match the expected version format" >> $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 triggered when a new release is published." >> $GITHUB_STEP_SUMMARY |