2023-12-28 12:20:38 +01:00
|
|
|
name: Publish viafied mcstructs
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run:
|
|
|
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Init submodule
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Check for changes
|
|
|
|
id: check_changes
|
|
|
|
run: |
|
|
|
|
git fetch origin && [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/HEAD)" ] && echo "changes=y" >> $GITHUB_OUTPUT || true
|
|
|
|
working-directory: MCStructs
|
|
|
|
|
|
|
|
- name: Setup Python
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
2024-05-12 12:50:27 +02:00
|
|
|
uses: actions/setup-python@v5
|
2023-12-28 12:20:38 +01:00
|
|
|
|
|
|
|
- name: Update and patch mcstructs
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
|
|
|
run: |
|
|
|
|
git submodule update --remote
|
|
|
|
python mcstructs.py
|
|
|
|
|
|
|
|
- name: Setup Java JDK
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
2024-05-12 12:50:27 +02:00
|
|
|
uses: actions/setup-java@v4
|
2023-12-28 12:20:38 +01:00
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: 17
|
|
|
|
check-latest: true
|
|
|
|
|
|
|
|
- name: Publish
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
|
|
|
env:
|
|
|
|
via_username: ${{ secrets.VIA_USERNAME }}
|
|
|
|
via_password: ${{ secrets.VIA_PASSWORD }}
|
2024-04-21 11:34:15 +02:00
|
|
|
run: ./gradlew publish -x checkstyleMain -x checkstyleTest -x test
|
2023-12-28 12:20:38 +01:00
|
|
|
working-directory: MCStructs
|
|
|
|
|
|
|
|
- name: Commit changes
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "automation"
|
|
|
|
git add .
|
|
|
|
git commit -am "Automated update"
|
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
if: steps.check_changes.outputs.changes == 'y'
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.TOKEN }}
|
|
|
|
branch: ${{ github.ref }}
|