.github/workflows/release.yml #8
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: | |
| workflow_dispatch: | |
| inputs: | |
| github-release: | |
| type: boolean | |
| description: "GitHub Release" | |
| hangar: | |
| type: boolean | |
| description: "Hangar" | |
| github-packages: | |
| type: boolean | |
| description: "GitHub Packages" | |
| maven-central: | |
| type: boolean | |
| description: "Maven Central" | |
| modrinth: | |
| type: boolean | |
| description: "Modrinth" | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| upload: | |
| runs-on: ubuntu-latest | |
| env: | |
| GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
| GPG_KEY_ASCII: ${{ secrets.GPG_KEY_ASCII }} | |
| GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version-file: .java-version | |
| - name: Build | |
| run: chmod +x ./gradlew && ./gradlew build | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| path: build/libs/*.jar | |
| name: libs | |
| - id: get_version | |
| run: | | |
| RESULT=$(./gradlew -q printVersion) | |
| echo "version=$RESULT" >> $GITHUB_OUTPUT | |
| - uses: softprops/action-gh-release@v3 | |
| if: ${{ inputs.github-release }} | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| files: build/libs/*[!{javadoc}{sources}].jar | |
| generate_release_notes: true | |
| - run: ./gradlew publishAllPublicationsToHangar syncPluginPublicationMainResourcePagePageToHangar --stacktrace | |
| if: ${{ inputs.hangar }} | |
| env: | |
| HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }} | |
| - run: ./gradlew modrinth modrinthSyncBody | |
| if: ${{ inputs.modrinth }} | |
| env: | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
| - run: ./gradlew publishAllPublicationsToGitHubPackagesRepository | |
| if: ${{ inputs.github-packages }} | |
| env: | |
| GITHUB_PACKAGES_USERNAME: Kiber2009 | |
| GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - run: ./gradlew publishMavenCentral | |
| if: ${{ inputs.maven-central }} | |
| env: | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |