Add automatic version updating feature
This commit is contained in:
52
.github/workflows/update-mod-versions.yml
vendored
Normal file
52
.github/workflows/update-mod-versions.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Update Mod Versions
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *' # Run every hour
|
||||
workflow_dispatch: # Allow manual triggers
|
||||
|
||||
jobs:
|
||||
update-versions:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # Needed to push changes
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests
|
||||
|
||||
- name: Update mod versions
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python .github/scripts/update_mod_versions.py
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config --global user.name 'GitHub Actions Bot'
|
||||
git config --global user.email 'actions@github.com'
|
||||
|
||||
# Check if there are changes to commit
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
COMMIT_MSG="Auto-update mod versions"
|
||||
if [ -f commit_message.txt ]; then
|
||||
COMMIT_MSG=$(cat commit_message.txt)
|
||||
fi
|
||||
|
||||
git add mods/*/meta.json
|
||||
git commit -m "$COMMIT_MSG"
|
||||
git push
|
||||
else
|
||||
echo "No changes to commit"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user