2023-02-25 03:05:15 +01:00
|
|
|
name: Build
|
|
|
|
|
2023-03-08 03:59:21 +01:00
|
|
|
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'
|
2023-02-25 03:05:15 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository and submodules
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
java-version: 17
|
|
|
|
distribution: temurin
|
2023-03-08 03:59:21 +01:00
|
|
|
|
|
|
|
- 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-
|
2023-02-25 03:05:15 +01:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
with:
|
2023-03-08 03:59:21 +01:00
|
|
|
arguments: build --no-daemon
|
|
|
|
|
|
|
|
- name: Archive artifacts (Geyser Fabric)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Fabric
|
|
|
|
path: bootstrap/fabric/build/libs/Geyser-Fabric.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Standalone)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Standalone
|
|
|
|
path: bootstrap/standalone/build/libs/Geyser-Standalone.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Spigot)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Spigot
|
|
|
|
path: bootstrap/spigot/build/libs/Geyser-Spigot.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser BungeeCord)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser BungeeCord
|
|
|
|
path: bootstrap/bungeecord/build/libs/Geyser-BungeeCord.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Sponge)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Sponge
|
|
|
|
path: bootstrap/sponge/build/libs/Geyser-Sponge.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Velocity)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Velocity
|
|
|
|
path: bootstrap/velocity/build/libs/Geyser-Velocity.jar
|
|
|
|
if-no-files-found: error
|
2023-02-25 03:05:15 +01:00
|
|
|
|
|
|
|
- name: Publish to Maven Repository
|
|
|
|
if: ${{ job.status == 'success' && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
env:
|
|
|
|
ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }}
|
|
|
|
ORG_GRADLE_PROJECT_geysermcPassword: ${{ secrets.DEPLOY_PASS }}
|
|
|
|
with:
|
|
|
|
arguments: publish
|
|
|
|
|
|
|
|
- name: Publish to Downloads API
|
|
|
|
if: ${{ github.ref_name == 'master' && job.status == 'success' && github.repository == 'GeyserMC/Geyser' }}
|
|
|
|
shell: bash
|
2023-02-25 03:57:43 +01:00
|
|
|
env:
|
2023-02-25 04:08:02 +01:00
|
|
|
DOWNLOADS_USERNAME: ${{ vars.DOWNLOADS_USERNAME }}
|
2023-02-25 03:57:43 +01:00
|
|
|
DOWNLOADS_PRIVATE_KEY: ${{ secrets.DOWNLOADS_PRIVATE_KEY }}
|
|
|
|
DOWNLOADS_SERVER_IP: ${{ secrets.DOWNLOADS_SERVER_IP }}
|
2023-02-25 03:05:15 +01:00
|
|
|
run: |
|
|
|
|
# Save the private key to a file
|
|
|
|
echo "$DOWNLOADS_PRIVATE_KEY" > id_ecdsa
|
|
|
|
chmod 600 id_ecdsa
|
2023-03-19 16:08:51 +01:00
|
|
|
# Set the project
|
|
|
|
project=geyser
|
2023-02-25 03:05:15 +01:00
|
|
|
# Get the version from gradle.properties
|
|
|
|
version=$(cat gradle.properties | grep -o "version=[0-9\\.]*" | cut -d"=" -f2)
|
|
|
|
# Copy over artifacts
|
2023-03-19 16:08:51 +01:00
|
|
|
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" bootstrap/**/build/libs/Geyser-*.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$project/$GITHUB_RUN_NUMBER/
|
2023-02-25 03:05:15 +01:00
|
|
|
# Run the build script
|
2023-03-19 16:08:51 +01:00
|
|
|
# Push the metadata
|
|
|
|
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/
|
2023-02-25 03:05:15 +01:00
|
|
|
|
|
|
|
- name: Notify Discord
|
2023-02-25 03:36:51 +01:00
|
|
|
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }}
|
2023-02-25 03:05:15 +01:00
|
|
|
uses: Tim203/actions-git-discord-webhook@main
|
|
|
|
with:
|
|
|
|
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
|
2023-02-25 03:36:51 +01:00
|
|
|
status: ${{ job.status }}
|