Skip to content

Organise imports

Organise imports #30

Workflow file for this run

# 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
with:
fetch-depth: 0
- name: Get all pushed commits
run: |
MULTI_LINE_CONTENT="`git log --pretty=format:'- [%h](https://github.com/eccentricdevotion/TARDIS/commit/%H) %s' ${{ github.event.before }}..${{ github.event.after }}`"
echo "GIT_COMMITS<<EOF" >> $GITHUB_ENV
echo "$MULTI_LINE_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- 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@v4
# set executable permissions on gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# build and publish to hangar.papermc.io
- name: Build with Gradle Wrapper
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
run: ./gradlew build publishPluginPublicationToHangar
- 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
id: update_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.TARDIS_WORKFLOW }}
tag_name: "${{ env.RELEASE_TAG }}"
files: build/libs/TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }}.jar
fail_on_unmatched_files: false
#body: "- ${{ github.event.head_commit.message }}"
body: "${{ env.GIT_COMMITS }}"
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
changelog: "- ${{ env.GIT_COMMITS }}" # 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
- name: Get current date
id: date
run: echo "::set-output name=today::$(date +'%d-%B-%Y %H:%M')"
- name: Send Discord notification
uses: stegzilla/discord-notify@v2
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
title: TARDIS Plugin Update
message: "TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }} is now available!\nReleased ${{ steps.date.outputs.today }}\n${{ env.GIT_COMMITS }}\n[View on GitHub](${{ steps.update_release.outputs.url }})"
include_image: false
avatar_url: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
username: TARDIS GitHub Notifier