From 7b0adf9f9f11d0354c71e33b8f3ace8cbe04c443 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 10 May 2024 15:42:42 +0200 Subject: [PATCH] Auto sync daily and publish to opencollab repo (cherry picked from commit ac693f1110b7d8b5a267d19e766d708fbef94848) --- .github/workflows/gradle.yml | 22 --------- .github/workflows/sync-publish.yml | 45 +++++++++++++++++++ .../main/kotlin/velocity-publish.gradle.kts | 4 +- proxy/build.gradle.kts | 1 + 4 files changed, 48 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/sync-publish.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index acec1f8502..0000000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://docs.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: 'temurin' - cache: 'gradle' - - name: Build with Gradle - run: ./gradlew build diff --git a/.github/workflows/sync-publish.yml b/.github/workflows/sync-publish.yml new file mode 100644 index 0000000000..214bfd6421 --- /dev/null +++ b/.github/workflows/sync-publish.yml @@ -0,0 +1,45 @@ +name: Sync and publish to opencollab repo + +on: + schedule: + - cron: '1 18 * * *' + workflow_dispatch: + inputs: + sync_test_mode: + description: 'Test fork sync config' + type: boolean + default: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Sync upstream changes + id: sync + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1 + with: + target_sync_branch: main + target_repo_token: ${{ secrets.GITHUB_TOKEN }} + upstream_sync_repo: PaperMC/Velocity + upstream_sync_branch: dev/3.0.0 + test_mode: ${{ inputs.sync_test_mode }} + - uses: actions/setup-java@v4 + if: steps.sync.outputs.has_new_commits == 'true' + with: + java-version: 17 + distribution: temurin + server-id: opencollab + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Setup Gradle + if: steps.sync.outputs.has_new_commits == 'true' + uses: gradle/actions/setup-gradle@v3 + with: + validate-wrappers: true + - name: Publish to Maven Repository + if: steps.sync.outputs.has_new_commits == 'true' + run: gradlew publish + env: + ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }} + ORG_GRADLE_PROJECT_geysermcPassword: ${{ secrets.DEPLOY_PASS }} diff --git a/build-logic/src/main/kotlin/velocity-publish.gradle.kts b/build-logic/src/main/kotlin/velocity-publish.gradle.kts index 51de5c6721..d63401afad 100644 --- a/build-logic/src/main/kotlin/velocity-publish.gradle.kts +++ b/build-logic/src/main/kotlin/velocity-publish.gradle.kts @@ -8,8 +8,8 @@ extensions.configure { maven { credentials(PasswordCredentials::class.java) - name = "paper" - val base = "https://repo.papermc.io/repository/maven" + name = "geysermc" + val base = "https://repo.opencollab.dev/maven" val releasesRepoUrl = "$base-releases/" val snapshotsRepoUrl = "$base-snapshots/" setUrl(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) diff --git a/proxy/build.gradle.kts b/proxy/build.gradle.kts index 5e1387b06c..98260b16be 100644 --- a/proxy/build.gradle.kts +++ b/proxy/build.gradle.kts @@ -4,6 +4,7 @@ plugins { application id("velocity-init-manifest") alias(libs.plugins.shadow) + id("velocity-publish") } application {