2023-02-25 02:05:15 +00:00
|
|
|
name: Build
|
|
|
|
|
2023-03-08 02:59:21 +00: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 02:05:15 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository and submodules
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/actions/checkout/commits
|
|
|
|
uses: actions/checkout@72f2cec99f417b1a1c5e2e88945068983b7965f9
|
2023-02-25 02:05:15 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-03-30 15:02:12 +00:00
|
|
|
- name: Validate Gradle Wrapper
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/gradle/wrapper-validation-action/commits
|
|
|
|
uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4
|
2023-03-30 15:02:12 +00:00
|
|
|
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/actions/setup-java/commits
|
|
|
|
- uses: actions/setup-java@4075bfc1b51bf22876335ae1cd589602d60d8758
|
2023-02-25 02:05:15 +00:00
|
|
|
with:
|
|
|
|
java-version: 17
|
|
|
|
distribution: temurin
|
2023-03-08 02:59:21 +00:00
|
|
|
|
2023-02-25 02:05:15 +00:00
|
|
|
- name: Build
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/gradle/gradle-build-action/commits
|
|
|
|
uses: gradle/gradle-build-action@3bfe3a46584a206fb8361cdedd0647b0c4204232
|
2023-02-25 02:05:15 +00:00
|
|
|
with:
|
2023-03-30 15:02:12 +00:00
|
|
|
arguments: build
|
|
|
|
gradle-home-cache-cleanup: true
|
2023-03-08 02:59:21 +00:00
|
|
|
|
|
|
|
- name: Archive artifacts (Geyser Fabric)
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/actions/upload-artifact/commits
|
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
2023-03-08 02:59:21 +00:00
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Fabric
|
|
|
|
path: bootstrap/fabric/build/libs/Geyser-Fabric.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Standalone)
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
2023-03-08 02:59:21 +00:00
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Standalone
|
|
|
|
path: bootstrap/standalone/build/libs/Geyser-Standalone.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Spigot)
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
2023-03-08 02:59:21 +00:00
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Spigot
|
|
|
|
path: bootstrap/spigot/build/libs/Geyser-Spigot.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser BungeeCord)
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
2023-03-08 02:59:21 +00:00
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser BungeeCord
|
|
|
|
path: bootstrap/bungeecord/build/libs/Geyser-BungeeCord.jar
|
|
|
|
if-no-files-found: error
|
|
|
|
- name: Archive artifacts (Geyser Velocity)
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
2023-03-08 02:59:21 +00:00
|
|
|
if: success()
|
|
|
|
with:
|
|
|
|
name: Geyser Velocity
|
|
|
|
path: bootstrap/velocity/build/libs/Geyser-Velocity.jar
|
|
|
|
if-no-files-found: error
|
2023-02-25 02:05:15 +00:00
|
|
|
|
|
|
|
- name: Publish to Maven Repository
|
2023-03-30 15:02:12 +00:00
|
|
|
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: gradle/gradle-build-action@3bfe3a46584a206fb8361cdedd0647b0c4204232
|
2023-02-25 02:05:15 +00:00
|
|
|
env:
|
|
|
|
ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }}
|
|
|
|
ORG_GRADLE_PROJECT_geysermcPassword: ${{ secrets.DEPLOY_PASS }}
|
|
|
|
with:
|
|
|
|
arguments: publish
|
|
|
|
|
|
|
|
- name: Publish to Downloads API
|
2023-03-30 15:02:12 +00:00
|
|
|
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
|
2023-02-25 02:05:15 +00:00
|
|
|
shell: bash
|
2023-02-25 02:57:43 +00:00
|
|
|
env:
|
2023-02-25 03:08:02 +00:00
|
|
|
DOWNLOADS_USERNAME: ${{ vars.DOWNLOADS_USERNAME }}
|
2023-02-25 02:57:43 +00:00
|
|
|
DOWNLOADS_PRIVATE_KEY: ${{ secrets.DOWNLOADS_PRIVATE_KEY }}
|
|
|
|
DOWNLOADS_SERVER_IP: ${{ secrets.DOWNLOADS_SERVER_IP }}
|
2023-02-25 02:05:15 +00:00
|
|
|
run: |
|
|
|
|
# Save the private key to a file
|
|
|
|
echo "$DOWNLOADS_PRIVATE_KEY" > id_ecdsa
|
|
|
|
chmod 600 id_ecdsa
|
2023-03-19 15:08:51 +00:00
|
|
|
# Set the project
|
|
|
|
project=geyser
|
2023-02-25 02:05:15 +00:00
|
|
|
# Get the version from gradle.properties
|
|
|
|
version=$(cat gradle.properties | grep -o "version=[0-9\\.]*" | cut -d"=" -f2)
|
2023-03-19 17:09:18 +00:00
|
|
|
# Create the build folder
|
|
|
|
ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP mkdir -p "~/uploads/$project/$GITHUB_RUN_NUMBER/"
|
2023-02-25 02:05:15 +00:00
|
|
|
# Copy over artifacts
|
2023-03-19 15:08:51 +00: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 02:05:15 +00:00
|
|
|
# Run the build script
|
2023-03-19 15:08:51 +00: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 02:05:15 +00:00
|
|
|
|
2023-03-30 15:02:12 +00:00
|
|
|
- name: Publish to Modrinth
|
2023-09-13 14:46:45 +00:00
|
|
|
uses: gradle/gradle-build-action@3bfe3a46584a206fb8361cdedd0647b0c4204232
|
2023-03-30 15:02:12 +00:00
|
|
|
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
|
|
|
|
|
2023-02-25 02:05:15 +00:00
|
|
|
- name: Notify Discord
|
2023-02-25 02:36:51 +00:00
|
|
|
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }}
|
2023-09-13 14:46:45 +00:00
|
|
|
# See https://github.com/Tim203/actions-git-discord-webhook/commits
|
|
|
|
uses: Tim203/actions-git-discord-webhook@70f38ded3aca51635ec978ab4e1a58cd4cd0c2ff
|
2023-02-25 02:05:15 +00:00
|
|
|
with:
|
|
|
|
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
|
2023-02-25 02:36:51 +00:00
|
|
|
status: ${{ job.status }}
|