Update BetterJSONs #1
This file contains hidden or 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
| name: Update BetterJSONs | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # ┌───────────── minute (0 - 59) | |
| # │ ┌───────────── hour (0 - 23) | |
| # │ │ ┌───────────── day of the month (1 - 31) | |
| # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
| # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
| # │ │ │ │ │ | |
| # * * * * * | |
| - cron: "30 17 * * 3" | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Checkout BetterJSONs repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: MCPHackers/BetterJSONs | |
| path: BetterJSONs | |
| ssh-key: ${{ secrets.BETTERJSONS_SSH }} | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Run update | |
| env: | |
| CI_COMMIT_MESSAGE: Automatic update | |
| CI_COMMIT_AUTHOR: github-actions[bot] | |
| CI_COMMIT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
| shell: bash | |
| run: | | |
| cd BetterJSONs | |
| git pull | |
| java -jar ../build/libs/versionjsons-1.0-all.jar --path ./jsons --generateManifest | |
| git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | |
| git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" | |
| if [[ `git status --porcelain --untracked-files=no` ]]; then | |
| # Changes | |
| git add . | |
| git commit -m "${{ env.CI_COMMIT_MESSAGE }}" | |
| git push | |
| else | |
| # No changes | |
| echo "no changes to latest posts" | |
| exit 0 | |
| fi | |