Repository navigation
fix: invert condition #61
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
| on: | |
| push: | |
| paths: | |
| - '**/src/**' | |
| - '.github/workflows/publish.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| repo: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| official: ${{ steps.repo.outputs.OFFICIAL }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - id: repo | |
| run: | | |
| REPO=$(mvn help:evaluate -Dexpression=project.distributionManagement.repository.url -q -DforceStdout) | |
| REPO="${REPO#https://maven.pkg.github.com/}" | |
| REPO="${REPO%/}" | |
| echo "OFFICIAL=$([ "$REPO" = "${{ github.repository }}" ] && echo true || echo false)" >> "$GITHUB_OUTPUT" | |
| main: | |
| needs: repo | |
| if: needs.repo.outputs.official == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - id: vars | |
| run: | | |
| echo "HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| echo "VERS=$(mvn help:evaluate -Dexpression=proj.vers -q -DforceStdout)" >> "$GITHUB_OUTPUT" | |
| echo "JAVA=$(mvn help:evaluate -Dexpression=maven.compiler.release -q -DforceStdout)" >> "$GITHUB_OUTPUT" | |
| echo "AFCT=$(mvn -pl :wlib-plugin help:evaluate -Dexpression=project.build.finalName -q -DforceStdout)" >> "$GITHUB_OUTPUT" | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: liberica | |
| java-version: ${{ steps.vars.outputs.JAVA }} | |
| server-id: github | |
| server-username: GITHUB_ACTOR | |
| server-password: GITHUB_TOKEN | |
| - run: mvn -B -DskipTests deploy | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - id: dist | |
| run: | | |
| echo "REL_NAME=${{ format('v{0}+{1}', steps.vars.outputs.VERS, steps.vars.outputs.HASH) }}" >> "$GITHUB_OUTPUT" | |
| echo "JAR_NAME=${{ format('{0}+{1}.jar', steps.vars.outputs.AFCT, steps.vars.outputs.HASH) }}" >> "$GITHUB_OUTPUT" | |
| - run: | | |
| mkdir -p dist | |
| cp modules/plugin/target/${{ steps.vars.outputs.AFCT }}.jar dist/${{ steps.dist.outputs.JAR_NAME }} | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| path: dist/${{ steps.dist.outputs.JAR_NAME }} | |
| name: ${{ steps.vars.outputs.AFCT }} | |
| if-no-files-found: error | |
| - id: mrtoken | |
| run: | | |
| echo "STATUS=$([ -n "${{ secrets.MODRINTH_TOKEN }}" ] && echo true || echo false)" >> "$GITHUB_OUTPUT" | |
| - id: mrinfo | |
| if: ${{ steps.mrtoken.outputs.STATUS == 'true' }} | |
| run: | | |
| echo "PROJECT_ID=$(curl -s "https://api.modrinth.com/v2/project/wlib" -H "Authorization: Bearer ${{ secrets.MODRINTH_TOKEN }}" | jq -r '.id')" >> "$GITHUB_OUTPUT" | |
| - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.mrtoken.outputs.STATUS == 'true' | |
| uses: cloudnode-pro/modrinth-publish@v2 | |
| with: | |
| token: ${{ secrets.MODRINTH_TOKEN }} | |
| project: ${{ steps.mrinfo.outputs.PROJECT_ID }} | |
| version: ${{ steps.dist.outputs.REL_NAME }} | |
| loaders: '["bukkit", "spigot", "paper", "purpur", "folia"]' | |
| game-versions: '["1.8.x", "1.9.x", "1.10.x", "1.11.x", "1.12.x", "1.13.x", "1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x", "1.19.x", "1.20.x", "1.21.x", "26.1.x", "26.2", "26.3"]' | |
| files: dist/${{ steps.dist.outputs.JAR_NAME }} | |
| primary-file: ${{ steps.dist.outputs.JAR_NAME }} | |
| name: ${{ steps.dist.outputs.REL_NAME }} | |
| channel: 'beta' |