mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Update Website-Stuff source on release
This commit is contained in:
parent
809e7a82af
commit
49b7c7aef4
1 changed files with 18 additions and 70 deletions
88
.github/workflows/updatesource.yml
vendored
88
.github/workflows/updatesource.yml
vendored
|
|
@ -1,104 +1,52 @@
|
||||||
name: Update StikJIT Source
|
name: Update StikDebug Source
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Add permissions block to ensure the workflow can push changes
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-source:
|
update-source:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout Website-Stuff
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
repository: StephenDev0/Website-Stuff
|
||||||
repository: 0-Blu/StikJIT
|
|
||||||
ref: main
|
ref: main
|
||||||
|
path: Website-Stuff
|
||||||
|
# A repository-scoped GITHUB_TOKEN cannot push to Website-Stuff.
|
||||||
|
token: ${{ secrets.WEBSITE_STUFF_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Update StikDebug source
|
||||||
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: 0-Blu/StikJIT"
|
|
||||||
echo "Event name: $GITHUB_EVENT_NAME"
|
|
||||||
echo "Current directory: $(pwd)"
|
|
||||||
echo "Repository contents:"
|
|
||||||
ls -la
|
|
||||||
|
|
||||||
- name: Update StikJIT source
|
|
||||||
id: update_source
|
id: update_source
|
||||||
env:
|
working-directory: Website-Stuff
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
# Configure git
|
|
||||||
git config --global user.name 'GitHub Action'
|
git config --global user.name 'GitHub Action'
|
||||||
git config --global user.email 'action@github.com'
|
git config --global user.email 'action@github.com'
|
||||||
|
|
||||||
# Run the update script
|
python updatesource.py index.json
|
||||||
python update_json.py
|
git add index.json
|
||||||
|
|
||||||
# Check for changes and commit if needed
|
|
||||||
git add repo.json
|
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "changes=false" >> $GITHUB_OUTPUT
|
echo "changes=false" >> $GITHUB_OUTPUT
|
||||||
echo "No changes detected in repo.json"
|
echo "No changes detected in index.json"
|
||||||
else
|
else
|
||||||
echo "Changes detected in repo.json:"
|
git commit -m "Update StikDebug source for latest release"
|
||||||
git diff --staged
|
|
||||||
git commit -m "Updated source with latest StikJIT release"
|
|
||||||
# Push to main branch of original repository
|
|
||||||
git push origin main
|
git push origin main
|
||||||
echo "changes=true" >> $GITHUB_OUTPUT
|
echo "changes=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
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
|
- name: Create job summary
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then
|
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then
|
||||||
echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY
|
echo "## StikDebug source updated" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "✅ Changes Detected and Pushed" >> $GITHUB_STEP_SUMMARY
|
echo "Website-Stuff/index.json was updated and pushed." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "The repo.json file has been updated with the latest release information." >> $GITHUB_STEP_SUMMARY
|
|
||||||
else
|
else
|
||||||
echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY
|
echo "## StikDebug source already current" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "🔍 No Changes Detected" >> $GITHUB_STEP_SUMMARY
|
echo "No change to Website-Stuff/index.json was needed." >> $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
|
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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue