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>
This commit is contained in:
Kas-tle 2023-03-30 08:02:12 -07:00 committed by GitHub
parent 95236b37e0
commit ed99655ed9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 44 deletions

View file

@ -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

View file

@ -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