diff options
Diffstat (limited to '.github/workflows/nightly.yaml')
| -rw-r--r-- | .github/workflows/nightly.yaml | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml new file mode 100644 index 0000000..6a162a2 --- /dev/null +++ b/.github/workflows/nightly.yaml @@ -0,0 +1,112 @@ +name: Nightly Release + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + - '*.md' + - 'LICENSE' + +concurrency: + group: nightly-release + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.version.outputs.version }} + paper_jar_name: ${{ steps.version.outputs.paper_jar_name }} + velocity_jar_name: ${{ steps.version.outputs.velocity_jar_name }} + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Compute nightly version + id: version + run: | + BASE_VERSION=$(grep ' version = ' build.gradle.kts | sed 's/.*version = "\(.*\)"/\1/' | sed "s/findProperty.*?: \"\(.*\)\"/\1/") + # Fallback: extract version from the default value + if [ -z "$BASE_VERSION" ] || echo "$BASE_VERSION" | grep -q 'findProperty'; then + BASE_VERSION="1.0.0" + fi + SHORT_HASH=$(git rev-parse --short HEAD) + NIGHTLY_VERSION="${BASE_VERSION}-nightly.${SHORT_HASH}" + echo "version=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT + echo "paper_jar_name=LunaticChat-${NIGHTLY_VERSION}.jar" >> $GITHUB_OUTPUT + echo "velocity_jar_name=LunaticChat-${NIGHTLY_VERSION}-velocity.jar" >> $GITHUB_OUTPUT + echo "Nightly version: $NIGHTLY_VERSION" + + - name: Setup Development Environment + uses: jdx/mise-action@v3 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with shadowJar + run: | + ./gradlew :platform-paper:shadowJar :platform-velocity:shadowJar \ + -Pversion=${{ steps.version.outputs.version }} \ + -PisNightly=true \ + --parallel --no-daemon + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: LunaticChat-nightly-${{ steps.version.outputs.version }} + path: | + platform-paper/build/libs/${{ steps.version.outputs.paper_jar_name }} + platform-velocity/build/libs/${{ steps.version.outputs.velocity_jar_name }} + retention-days: 7 + + release: + runs-on: ubuntu-24.04 + needs: build + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Download build artifact + uses: actions/download-artifact@v8 + with: + name: LunaticChat-nightly-${{ needs.build.outputs.version }} + + - name: Delete existing nightly release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release delete nightly --yes --cleanup-tag 2>/dev/null || true + + - name: Create nightly release + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=${{ needs.build.outputs.version }} + PAPER_JAR_NAME=${{ needs.build.outputs.paper_jar_name }} + VELOCITY_JAR_NAME=${{ needs.build.outputs.velocity_jar_name }} + + gh release create nightly \ + "platform-paper/build/libs/$PAPER_JAR_NAME" \ + "platform-velocity/build/libs/$VELOCITY_JAR_NAME" \ + --title "Nightly Build ($VERSION)" \ + --prerelease \ + --notes "$(cat <<'EOF' + ## ⚠️ Nightly Build + + This is an automatically generated nightly build from the latest `main` branch. + + **Warning:** This build may be unstable or contain bugs. Do not use in production environments. + + - **Version:** `${{ needs.build.outputs.version }}` + - **Commit:** ${{ github.sha }} + + If you encounter any issues, please report them on [GitHub Issues](https://github.com/m1sk9/LunaticChat/issues). + EOF + )" |
