Skip to content

Fetch Minecraft Server Version #44

Fetch Minecraft Server Version

Fetch Minecraft Server Version #44

name: Fetch Minecraft Server Version
on:
push:
paths:
- '.github/workflows/fetch-version.yaml'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
fetch-version:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt install chromium-browser -y
pip install selenium
- name: Fetch Minecraft Server Version
run: |
python scripts/fetch_version.py | while IFS='=' read -r key value; do
if [ -n "$key" ] && [ -n "$value" ]; then
echo "$key=$value" >> $GITHUB_ENV
fi
done
- name: Create versions Directory if not exists
run: mkdir -p versions
- name: Store Fetched Stable Version
run: |
echo $STABLE_VERSION > versions/stable.txt
- name: Commit and Push Stable Changes
uses: EndBug/add-and-commit@v9
with:
add: 'versions/stable.txt'
message: "Update stable version"
default_author: github_actions
- name: Store Fetched Preview Version
run: |
echo $PREVIEW_VERSION > versions/preview.txt
- name: Commit and Push Preview Changes
uses: EndBug/add-and-commit@v9
with:
add: 'versions/preview.txt'
message: "Update preview version"
default_author: github_actions