Update gradle.yml #19
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
| # This workflow will build TARDIS with Gradle | |
| # and upload the JAR file to the latest release | |
| # plus create a version on Modrinth | |
| name: Java CI with Gradle | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| env: | |
| VERSION: '6.2.3' | |
| RELEASE_TAG: '1.21.8' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| # get short sha | |
| - name: Set SHORT_SHA env property | |
| run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV | |
| # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
| # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
| # set executable permissions on gradlew | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # build | |
| - name: Build with Gradle Wrapper | |
| run: ./gradlew build | |
| - name: Delete old release assets | |
| uses: mknejp/delete-release-assets@v1 | |
| with: | |
| assets: 'TARDIS-*.jar' # filename of asset to delete | |
| tag: "${{ env.RELEASE_TAG }}" # the tag of the release to modify | |
| token: ${{ secrets.TARDIS_WORKFLOW }} # Required for authentication | |
| - name: Upload build artifacts to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.TARDIS_WORKFLOW }} | |
| name: "TARDIS for ${{ env.RELEASE_TAG }}" | |
| tag_name: "${{ env.RELEASE_TAG }}" | |
| files: build/libs/*.jar | |
| fail_on_unmatched_files: false | |
| body: 'Latest build from GitHub Actions CI' | |
| generate_release_notes: true | |
| #body: "- ${{ github.event.head_commit.message }}" | |
| append_body: true | |
| - name: Modrinth Publish | |
| uses: cloudnode-pro/modrinth-publish@v2.1.3 | |
| with: | |
| token: ${{ secrets.MODRINTH_TOKEN }} # Modrinth API token | |
| project: 'ymLTIuUH' # ID of the project this version is for | |
| name: "TARDIS ${{ env.VERSION }}-b${{ env.SHORT_SHA }}" | |
| version: "${{ env.VERSION }}-b${{ env.SHORT_SHA }}" | |
| changelog: "- ${{ github.event.head_commit.message }}" # The changelog for this version | |
| # mod loaders that this version supports | |
| loaders: |- | |
| paper | |
| # list of versions of Minecraft that this version supports | |
| game-versions: |- | |
| ${{ env.RELEASE_TAG }} | |
| # list of file paths to upload | |
| files: |- | |
| build/libs/TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }}.jar |