Skip to content

Release v1.11.0

Release v1.11.0 #633

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build with Maven
on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
# Compile the project
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure maven's settings.xml (mirrors, deployment credentials)
uses: whelk-io/maven-settings-xml-action@v22
with:
mirrors: >
[
{
"id": "Sonatype-Nexus-Snapshots-mirror",
"name": "Sonatype-Nexus-Snapshots-Repository [Mirror]",
"url": "https://repo.sprax2013.de/repository/sonatype-nexus-snapshots/",
"mirrorOf": "sonatype-nexus-snapshots"
},
{
"id": "Central-mirror",
"name": "Central-Repository [Mirror]",
"url": "https://repo.sprax2013.de/repository/central/",
"mirrorOf": "central"
},
{
"id": "SpigotMC-Snapshots-mirror",
"name": "SpigotMC-Snapshots-Repository [Mirror]",
"url": "https://repo.sprax2013.de/repository/SpigotMC-Snapshots/",
"mirrorOf": "SpigotMC,SpigotMC-repo,spigotmc,spigotmc-repo,spigot-repo,spigotmc-snapshots"
},
{
"id": "SpigotMC-Releases-mirror",
"name": "SpigotMC-Releases-Repository [Mirror]",
"url": "https://repo.sprax2013.de/repository/SpigotMC-Releases/",
"mirrorOf": "spigotmc-releases"
},
{
"id": "Minecraft-Libraries-mirror",
"name": "Minecraft-Libraries-Repository [Mirror]",
"url": "https://repo.sprax2013.de/repository/Minecraft-Libraries/",
"mirrorOf": "minecraft-libraries"
}
]
# Use Java 8 to compile old Spigot version
- uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
overwrite-settings: false
cache: maven
- name: Compile Spigot versions (1.8 – 1.16.5)
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.8, 1.8.3, 1.8.8, 1.9.2, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13, 1.13.2, 1.14.4, 1.15.2, 1.16.1, 1.16.3, 1.16.5
sftpCacheHost: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST }}
sftpCachePort: ${{ vars.SPIGOT_BUILDTOOLS_SFTP_PORT }}
sftpCacheUser: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_USER }}
sftpCachePrivateKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_PRIVATE_KEY }}
sftpCacheExpectedHostKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST_KEY }}
# Use Java 16 for Spigot 1.17
- uses: actions/setup-java@v4
with:
java-version: 16
distribution: temurin
overwrite-settings: false
- name: Compile Spigot versions (1.17)
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: '1.17'
sftpCacheHost: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST }}
sftpCachePort: ${{ vars.SPIGOT_BUILDTOOLS_SFTP_PORT }}
sftpCacheUser: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_USER }}
sftpCachePrivateKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_PRIVATE_KEY }}
sftpCacheExpectedHostKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST_KEY }}
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
overwrite-settings: false
- name: Compile Spigot versions (1.18.1 – 1.20.4)
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.18.1, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20.1, 1.20.2, 1.20.4
remapped: true
sftpCacheHost: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST }}
sftpCachePort: ${{ vars.SPIGOT_BUILDTOOLS_SFTP_PORT }}
sftpCacheUser: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_USER }}
sftpCachePrivateKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_PRIVATE_KEY }}
sftpCacheExpectedHostKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST_KEY }}
# Use Java 21 for everything else
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
overwrite-settings: false
- name: Compile Spigot versions (1.20.6 – 1.21.1)
uses: SpraxDev/Action-SpigotMC@v5
with:
versions: 1.20.6, 1.21.1
remapped: true
sftpCacheHost: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST }}
sftpCachePort: ${{ vars.SPIGOT_BUILDTOOLS_SFTP_PORT }}
sftpCacheUser: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_USER }}
sftpCachePrivateKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_PRIVATE_KEY }}
sftpCacheExpectedHostKey: ${{ secrets.SPIGOT_BUILDTOOLS_SFTP_HOST_KEY }}
# Compile the project using maven
- name: Build with Maven
run: 'mvn -B -Duser.name="GitHub Runner on $GITHUB_REPOSITORY (id=$GITHUB_RUN_ID)" clean package'
# Upload the .jar file
- name: 'Upload Build Artifact: BetterChairs.jar'
uses: actions/upload-artifact@v4
with:
name: BetterChairs
path: ./modules/betterchairs-plugin/target/BetterChairs*.jar
# Run static code analysis
- name: 'SonarCloud.io (static code analysis)'
if: ${{ env.SONAR_TOKEN != null }}
run: 'mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Check if the versions inside `pom.xml`, CHANGELOG.md and `./docs/version.txt`
# match and that everything has been edited correctly when pushing a new release version
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version from the pom.xml and compare to docs/version.txt
id: version_diff # Outputs 'same' or 'diff'
run: mkdir -p docs && echo $(grep --max-count=1 '<version>' pom.xml | awk -F '>' '{ print $2 }' | awk -F '<' '{ print $1 }') >> docs/version_new.txt && diff -q --ignore-space-change --strip-trailing-cr --ignore-blank-lines docs/version.txt docs/version_new.txt 2>&1 && echo "result=same" >> $GITHUB_OUTPUT || echo "result=diff" >> $GITHUB_OUTPUT
- name: Check if extracted version matches docs/version.txt
if: ${{ steps.version_diff.outputs.result != 'same' }}
uses: unsplash/comment-on-pr@master
with:
msg: "Versions in `pom.xml` and `docs/version.txt` are not the same! Please use the same version in both files."
check_for_duplicate_msg: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if version from docs/version.txt is inside CHANGELOG.md
id: inside_changelog # Outputs 'yes' or 'no'
run: verTxt=$(cat docs/version.txt) && grep -q "## Version ${verTxt}" CHANGELOG.md && echo "result=yes" >> $GITHUB_OUTPUT || echo "result=no" >> $GITHUB_OUTPUT
- name: Check if extracted version matches docs/version.txt
if: ${{ steps.inside_changelog.outputs.result != 'yes' }}
uses: unsplash/comment-on-pr@master
with:
msg: "`CHANGELOG.md` is missing changes for version in `docs/version.txt`!"
check_for_duplicate_msg: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail Action when versions (from above) are not the same
if: ${{ steps.version_diff.outputs.result != 'same' }}
run: echo "The versions inside pom.xml and docs/version.txt are not the same!" && exit -1
- name: Fail Action when docs/version.txt not inside CHANGELOG.md
if: ${{ steps.inside_changelog.outputs.result != 'yes' }}
run: echo "CHANGELOG.md is missing changes for version in docs/version.txt!" && exit -1