.github/workflows/update_version.yml #161
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
on: | |
workflow_dispatch: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 3 * * 0' | |
jobs: | |
update_versionlist: | |
name: Updates version.csv, containing the links | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Run updateScript | |
run: | | |
python scripts/updateServerVersions.py | |
- name: check for changes | |
run: | | |
if git diff --exit-code; then | |
echo "changes_exist=false" >> $GITHUB_ENV | |
else | |
echo "changes_exist=true" >> $GITHUB_ENV | |
fi | |
- name: Commit files # transfer the new html files back into the repository | |
if: ${{ env.changes_exist == 'true' }} | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git add ./minecraft/versions.csv | |
git commit -m "Workflow updating the version.csv" | |
- name: Push changes # push the output folder to your repo | |
if: ${{ env.changes_exist == 'true' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true |