From ed99655ed9f1b666aa37f48c57cf6e1ed54370dc Mon Sep 17 00:00:00 2001 From: Kas-tle <26531652+Kas-tle@users.noreply.github.com> Date: Thu, 30 Mar 2023 08:02:12 -0700 Subject: [PATCH] Do Modrinth Publish in build.yml (#3644) * Migrate modrinth publish and edit caching Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Address review from tim --------- Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> --- .github/workflows/build.yml | 29 ++++++++++++++++------------- .github/workflows/publish.yml | 31 ------------------------------- 2 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 668c9ca72..ca8b63cc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,25 +23,19 @@ jobs: with: submodules: recursive + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - uses: actions/setup-java@v3 with: java-version: 17 distribution: temurin - - name: Cache Gradle Packages - uses: actions/cache@v3 - with: - path: | - ~/.m2 - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ github.ref_name }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle.properties', 'gradlew', 'gradle/*', 'gradle/**/*', 'build-logic/*', 'build-logic/**/**/**/*', '**/*.gradle.kts', '**/**/*.gradle.kts') }} - restore-keys: ${{ github.ref_name }}-gradle- - - name: Build uses: gradle/gradle-build-action@v2 with: - arguments: build --no-daemon + arguments: build + gradle-home-cache-cleanup: true - name: Archive artifacts (Geyser Fabric) uses: actions/upload-artifact@v3 @@ -87,7 +81,7 @@ jobs: if-no-files-found: error - name: Publish to Maven Repository - if: ${{ job.status == 'success' && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }} + if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }} uses: gradle/gradle-build-action@v2 env: ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }} @@ -96,7 +90,7 @@ jobs: arguments: publish - name: Publish to Downloads API - if: ${{ github.ref_name == 'master' && job.status == 'success' && github.repository == 'GeyserMC/Geyser' }} + if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }} shell: bash env: DOWNLOADS_USERNAME: ${{ vars.DOWNLOADS_USERNAME }} @@ -119,6 +113,15 @@ jobs: echo "{\"project\": \"$project\", \"version\": \"$version\", \"id\": $GITHUB_RUN_NUMBER, \"commit\": \"$GITHUB_SHA\"}" > metadata.json rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" metadata.json $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$project/$GITHUB_RUN_NUMBER/ + - name: Publish to Modrinth + uses: gradle/gradle-build-action@v2 + if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }} + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + with: + arguments: fabric:modrinth + gradle-home-cache-cleanup: true + - name: Notify Discord if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }} uses: Tim203/actions-git-discord-webhook@main diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 2b002b0de..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish -on: - workflow_dispatch: - push: - paths-ignore: - - '.github/ISSUE_TEMPLATE/*.yml' - - '.github/actions/pullrequest.yml' - - '.idea/copyright/*.xml' - - '.gitignore' - - 'CONTRIBUTING.md' - - 'LICENSE' - - 'Jenkinsfile ' - - 'README.md' - - 'licenseheader.txt' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: gradle/wrapper-validation-action@v1 - - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - name: Publish to Modrinth - env: - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - run: ./gradlew fabric:modrinth \ No newline at end of file