Fix: Repo patterns again? #2815
Workflow file for this run
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
| # Read the Javadoc of RepoPatternDump for more info | |
| name: RepoPattern | |
| env: | |
| data_repo: hannibal002/SkyHanni-REPO | |
| repo_action: true | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: { } | |
| jobs: | |
| regexes: | |
| runs-on: ubuntu-latest | |
| name: "Generate regexes" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| cache: gradle | |
| - name: Setup gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Disable preprocessor | |
| run: | | |
| mkdir -p .gradle | |
| echo skyhanni.multi-version=off > .gradle/private.properties | |
| - name: Generate Repo Patterns using Gradle w/retry | |
| uses: ./.github/actions/gradle-retry | |
| with: | |
| gradle-command: generateRepoPatterns --stacktrace | |
| - uses: actions/upload-artifact@v4 | |
| name: Upload generated repo regexes | |
| with: | |
| name: Repo Regexes | |
| path: versions/1.21.10/build/regexes/constants.json | |
| publish-regexes: | |
| runs-on: ubuntu-latest | |
| needs: regexes | |
| name: "Publish regexes" | |
| # 511310721 is the Repository ID for SkyHanni | |
| if: ${{ 'push' == github.event_name && 'beta' == github.ref_name && '511310721' == github.repository_id }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ env.data_repo }} | |
| branch: main | |
| persist-credentials: false | |
| - uses: actions/download-artifact@v4 | |
| name: Upload generated repo regexes | |
| with: | |
| name: Repo Regexes | |
| - name: Commit generated regex | |
| run: | | |
| mkdir -p constants/ | |
| new_cmp="$(jq -S '.regexes' < constants.json)" | |
| old_cmp="$(jq -S '.regexes' < constants/regexesModern.json)" | |
| if [ "$new_cmp" = "$old_cmp" ]; then | |
| echo Old and new are the same. We are in a never ending loop. | |
| exit 0 | |
| fi | |
| mv constants.json constants/regexesModern.json | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '[email protected]' | |
| git add constants/regexesModern.json | |
| git commit -m "Update regexes based on https://github.com/hannibal002/Skyhanni/commit/$GITHUB_SHA" | |
| - name: Publish new repository | |
| run: | | |
| git remote add restream https://user:${{secrets.REPO_PAT}}@github.com/${{env.data_repo}} | |
| git push restream HEAD:main |