Mappings/.github/workflows/main.yml
2023-03-05 10:08:46 +01:00

71 lines
2.3 KiB
YAML

name: Check for new Minecraft snapshot
on:
schedule:
- cron: '10 * * * *'
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Maven
uses: s4u/setup-maven-action@v1.7.0
with:
java-version: 17
- name: Check for snapshot
run: pip install -r requirements.txt && python download_server.py
# Wooyeah
- name: Read last snapshot
id: last_snapshot
uses: juliangruber/read-file-action@v1
with:
path: ./last_snapshot.txt
- name: Read last release
id: last_release
uses: juliangruber/read-file-action@v1
with:
path: ./last_release.txt
- name: Read next release
id: next_release
uses: juliangruber/read-file-action@v1
with:
path: ./next_release.txt
- name: Compile MappingsGenerator jar
run: mvn package && mvn package && mv target/MappingsGenerator-*.jar ./MappingsGenerator.jar
- name: Run MappingsGenerator
run: java -jar MappingsGenerator.jar server.jar ${{ steps.next_release.outputs.content }} ${{ steps.last_release.outputs.content }}
- name: Pack mappings
run: java -cp MappingsGenerator.jar com.viaversion.mappingsgenerator.MappingsOptimizer ${{ steps.last_release.outputs.content }} ${{ steps.next_release.outputs.content }}
- name: Pack backwards mappings
run: java -cp MappingsGenerator.jar com.viaversion.mappingsgenerator.MappingsOptimizer ${{ steps.next_release.outputs.content }} ${{ steps.last_release.outputs.content }}
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "automation"
git add .
git commit -am "Update: ${{ steps.last_snapshot.outputs.content }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.TOKEN }}
branch: ${{ github.ref }}