2020-11-23 17:49:08 +00:00
|
|
|
name: "build"
|
|
|
|
|
|
|
|
on: ["pull_request", "push"]
|
2021-07-25 15:46:33 +00:00
|
|
|
|
2020-11-23 17:49:08 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
2021-10-08 17:03:41 +00:00
|
|
|
runs-on: "ubuntu-latest"
|
2020-11-23 17:49:08 +00:00
|
|
|
steps:
|
2021-07-25 15:46:33 +00:00
|
|
|
- name: "Checkout Repository"
|
2021-11-22 12:38:32 +00:00
|
|
|
uses: "actions/checkout@v2.4.0"
|
2021-10-08 17:03:41 +00:00
|
|
|
- name : "Validate Gradle Wrapper"
|
|
|
|
uses : "gradle/wrapper-validation-action@v1.0.4"
|
|
|
|
- name: "Setup Java"
|
|
|
|
uses: "actions/setup-java@v2.3.1"
|
2021-07-25 15:46:33 +00:00
|
|
|
with:
|
2021-08-09 13:09:55 +00:00
|
|
|
distribution: "temurin"
|
2021-10-17 14:32:36 +00:00
|
|
|
cache: 'gradle'
|
2021-10-08 17:03:41 +00:00
|
|
|
java-version: "17"
|
2021-07-25 15:46:33 +00:00
|
|
|
- name: "Clean Build"
|
2021-10-17 14:32:36 +00:00
|
|
|
run: "./gradlew clean build --no-daemon"
|
2021-11-22 12:38:32 +00:00
|
|
|
- name: "Determine release status"
|
|
|
|
if: "${{ runner.os == 'Linux' }}"
|
|
|
|
run: |
|
|
|
|
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
|
|
|
echo "STATUS=snapshot" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "STATUS=release" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
- name: "Publish Release"
|
2021-11-22 17:11:27 +00:00
|
|
|
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}"
|
2021-11-22 12:38:32 +00:00
|
|
|
run: "./gradlew publishToSonatype closeSonatypeStagingRepository"
|
|
|
|
env:
|
|
|
|
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
|
|
|
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
|
|
|
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
|
|
|
|
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
|
|
|
|
- name: "Publish Snapshot"
|
2021-11-22 17:11:27 +00:00
|
|
|
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
|
2021-11-22 12:38:32 +00:00
|
|
|
run: "./gradlew publishToSonatype"
|
|
|
|
env:
|
|
|
|
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
|
|
|
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
|
|
|
- name: "Archive Artifacts"
|
|
|
|
uses: "actions/upload-artifact@v2.2.4"
|
2021-07-28 13:04:49 +00:00
|
|
|
with:
|
2021-11-22 12:38:32 +00:00
|
|
|
name: "FastAsyncWorldEdit-Bukkit-SNAPSHOT"
|
|
|
|
path: "worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar"
|