Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ on:
- '**.py'

permissions:
pages: write
contents: write
id-token: write

jobs:
update_forge-metadata:
update-metadata:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- name: Set time
shell: bash
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: Set up Python
uses: actions/setup-python@v6
Expand All @@ -29,37 +33,27 @@ jobs:
python3 -m pip install --upgrade pip
python3 -m pip install xmljson requests python-dateutil
- name: Fetch forge-metadata changes
id: fetch_forge_changes
shell: bash
run: |
cd ./forge/scripts
python3 xml_to_json.py
python3 main.py
python3 install.py
python3 gettime.py
mv index.json ../
cd ../..
- name: Fetch cleanroom-metadata changes
id: fetch_cleanroom_changes
shell: bash
run: |
cd ./cleanroom/scripts
python3 main.py
mv index.json ../
cd ../..
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch optifine-metadata changes
id: fetch_optifine_changes
shell: bash
run: |
cd ./optifine/scripts
python3 main.py
python3 converter.py
mv index.json ../
cd ../..
- name: Commit changes
shell: bash
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand All @@ -68,6 +62,7 @@ jobs:

if git diff --cached --quiet; then
echo "No changes detected, skip commit and push."
echo "SKIP=true" >> $GITHUB_ENV
exit 0
fi

Expand All @@ -76,3 +71,24 @@ jobs:
GitHub Action: https://github.com/${{ github.repository }}/actions/runs/$GITHUB_RUN_ID
"
git push origin
- name: Build Pages
if: ${{ env.SKIP != 'true' }}
run: |
mkdir -p /home/runner/gh-pages/{cleanroom,forge,optifine}
mv ./cleanroom/index.json /home/runner/gh-pages/cleanroom/
mv ./cleanroom/files /home/runner/gh-pages/cleanroom/
mv ./fmllibs /home/runner/gh-pages/
mv ./forge/index.json /home/runner/gh-pages/forge/
mv ./optifine/index.json /home/runner/gh-pages/optifine/
- name: Upload Pages
if: ${{ env.SKIP != 'true' }}
uses: actions/upload-pages-artifact@v4
with:
name: github-pages
path: /home/runner/gh-pages
- name: Deploy Pages
if: ${{ env.SKIP != 'true' }}
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages