Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de3d170347 | |||
| d7012e0ddd | |||
| 173c21d346 | |||
| 3fa4e518ac |
@@ -18,72 +18,23 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
|
# Writes a <server id="smr"> entry to ~/.m2/settings.xml that reads the credentials from these env vars
|
||||||
|
server-id: smr
|
||||||
|
server-username: MAVEN_DEPLOY_USER
|
||||||
|
server-password: MAVEN_DEPLOY_TOKEN
|
||||||
|
|
||||||
- name: Set up Maven
|
- name: Set up Maven
|
||||||
uses: stCarolas/setup-maven@v5
|
uses: stCarolas/setup-maven@v5
|
||||||
with:
|
with:
|
||||||
maven-version: 3.9.6
|
maven-version: 3.9.6
|
||||||
|
|
||||||
- name: Get release version
|
|
||||||
id: get_version
|
|
||||||
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set version from release tag
|
- name: Set version from release tag
|
||||||
run: mvn -B versions:set -DnewVersion="${{ github.event.release.tag_name }}" -DgenerateBackupPoms=false
|
run: mvn -B versions:set -DnewVersion="${{ github.event.release.tag_name }}" -DgenerateBackupPoms=false
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build and deploy
|
||||||
run: mvn -B -U -C clean package -DskipTests
|
env:
|
||||||
|
MAVEN_DEPLOY_USER: ${{ vars.MAVEN_DEPLOY_USER }}
|
||||||
- name: Extract Maven coordinates
|
MAVEN_DEPLOY_TOKEN: ${{ secrets.MAVEN_DEPLOY_TOKEN }}
|
||||||
id: meta
|
|
||||||
run: |
|
run: |
|
||||||
echo "groupId=$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout)" >> $GITHUB_OUTPUT
|
mvn -B -U clean deploy -DskipTests \
|
||||||
echo "artifactId=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_OUTPUT
|
-DaltDeploymentRepository=smr::default::${{ vars.MAVEN_REPO_URL }}
|
||||||
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Set up SSH
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.MVN_REPO_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -H ${{ secrets.MVN_REPO_SSH_HOST }} >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Generate checksums
|
|
||||||
run: |
|
|
||||||
ARTIFACT_ID=${{ steps.meta.outputs.artifactId }}
|
|
||||||
VERSION=${{ steps.meta.outputs.version }}
|
|
||||||
|
|
||||||
JAR_FILE=target/$ARTIFACT_ID-$VERSION.jar
|
|
||||||
POM_FILE=target/$ARTIFACT_ID-$VERSION.pom
|
|
||||||
|
|
||||||
cp pom.xml $POM_FILE
|
|
||||||
|
|
||||||
for file in $JAR_FILE $POM_FILE; do
|
|
||||||
sha1sum "$file" | awk '{ print $1 }' > "$file.sha1"
|
|
||||||
md5sum "$file" | awk '{ print $1 }' > "$file.md5"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Upload artifact and checksums to VPS
|
|
||||||
run: |
|
|
||||||
GROUP_PATH=$(echo "${{ steps.meta.outputs.groupId }}" | sed 's/\./\//g')
|
|
||||||
ARTIFACT_ID=${{ steps.meta.outputs.artifactId }}
|
|
||||||
VERSION=${{ steps.meta.outputs.version }}
|
|
||||||
REMOTE_DIR="${{ secrets.REMOTE_MAVEN_PATH }}/$GROUP_PATH/$ARTIFACT_ID/$VERSION"
|
|
||||||
|
|
||||||
echo "Creating remote directory: $REMOTE_DIR"
|
|
||||||
ssh ${{ secrets.MVN_REPO_SSH_USER }}@${{ secrets.MVN_REPO_SSH_HOST }} "mkdir -p $REMOTE_DIR"
|
|
||||||
|
|
||||||
FILES=(
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar.sha1"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar.md5"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom.sha1"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom.md5"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "Uploading files..."
|
|
||||||
for file in "${FILES[@]}"; do
|
|
||||||
echo "Uploading $file"
|
|
||||||
scp "$file" ${{ secrets.MVN_REPO_SSH_USER }}@${{ secrets.MVN_REPO_SSH_HOST }}:$REMOTE_DIR/
|
|
||||||
done
|
|
||||||
@@ -63,17 +63,18 @@ This will:
|
|||||||
All options go inside the `<configuration>` block of the plugin declaration.
|
All options go inside the `<configuration>` block of the plugin declaration.
|
||||||
|
|
||||||
| Option | Default | Description |
|
| Option | Default | Description |
|
||||||
|---|---|---------------------------------------------------------------------------------------------------------------------------------|
|
|---|---|---|
|
||||||
| `mcVersion` | *(required)* | The Minecraft version to run, e.g. `1.21.4` |
|
| `mcVersion` | *(required)* | The Minecraft version to run, e.g. `1.21.4` |
|
||||||
| `acceptEula` | `false` | Automatically accept the [Minecraft EULA](https://aka.ms/MinecraftEULA). By setting this to `true` you confirm your acceptance. |
|
| `acceptEula` | `false` | Automatically accept the [Minecraft EULA](https://aka.ms/MinecraftEULA). By setting this to `true` you confirm your acceptance. |
|
||||||
| `serverSoftware` | `paper` | Server software to use. Supported values: `paper`, `spigot` |
|
| `serverSoftware` | `paper` | Server software to use. Supported values: `paper`, `spigot` |
|
||||||
| `serverDirectory` | `./server` | Folder where the server files will be created |
|
| `serverDirectory` | `./server` | Folder where the server files will be created |
|
||||||
| `serverJarName` | `server.jar` | File name for the server jar inside `serverDirectory` |
|
| `serverJarName` | `server.jar` | File name for the server jar inside `serverDirectory` |
|
||||||
| `memory` | `2G` | RAM allocated to the server (used for both `-Xmx` and `-Xms`), e.g. `2G`, `512M` |
|
| `minMemory` | `512M` | Minimum RAM allocated to the server (`-Xms`), e.g. `512M`, `1G` |
|
||||||
|
| `maxMemory` | `2G` | Maximum RAM allocated to the server (`-Xmx`), e.g. `2G`, `4G` |
|
||||||
| `port` | *(Minecraft default)* | Port the server listens on |
|
| `port` | *(Minecraft default)* | Port the server listens on |
|
||||||
| `remoteDebug` | `false` | Enable remote JVM debugging so you can attach your IDE's debugger |
|
| `remoteDebug` | `false` | Enable remote JVM debugging so you can attach your IDE's debugger |
|
||||||
| `debugPort` | `5005` | Port used for remote debugging (only relevant if `remoteDebug` is `true`) |
|
| `debugPort` | `5005` | Port used for remote debugging (only relevant if `remoteDebug` is `true`) |
|
||||||
| `jvmArgs` | *(none)* | Extra JVM flags passed to the server process (see below) |
|
| `jvmArgs` | *(none)* | Extra JVM flags passed to the server process |
|
||||||
| `pluginJar` | *(your built jar)* | Path to the plugin jar to deploy. You rarely need to change this |
|
| `pluginJar` | *(your built jar)* | Path to the plugin jar to deploy. You rarely need to change this |
|
||||||
|
|
||||||
### Full configuration example
|
### Full configuration example
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<groupId>org.strassburger</groupId>
|
<groupId>org.strassburger</groupId>
|
||||||
<artifactId>mcrun-maven-plugin</artifactId>
|
<artifactId>mcrun-maven-plugin</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<packaging>maven-plugin</packaging>
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
<name>MCRun Maven Plugin</name>
|
<name>MCRun Maven Plugin</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user