diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e9b890a..5dda57f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,30 @@ jobs: with: arguments: build - - name: Publish + - name: Publish to Maven Repository uses: gradle/gradle-build-action@v2 env: ORG_GRADLE_PROJECT_geysermcUsername: ${{ vars.DEPLOY_USER }} ORG_GRADLE_PROJECT_geysermcPassword: ${{ secrets.DEPLOY_PASS }} with: - arguments: publish \ No newline at end of file + arguments: publish + + - name: Publish to Downloads API + if: ${{ github.ref_name == "master" && job.status == "success" }} + shell: bash + run: | + # Save the private key to a file + echo "$DOWNLOADS_PRIVATE_KEY" > id_ecdsa + chmod 600 id_ecdsa + + # Get the version from gradle.properties + version=$(cat gradle.properties | grep -o "version=[0-9\\.]*" | cut -d"=" -f2) + + # Copy over artifacts + scp -B -o StrictHostKeyChecking=no -i id_ecdsa **/build/libs/floodgate-*.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/files/ + + # Remove un-needed artifacts + ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP rm ~/files/floodgate-parent-*.jar ~/files/floodgate-api.jar ~/files/floodgate-core.jar + + # Run the build script + ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP ./handleBuild.sh floodgate $version $GITHUB_RUN_ID $GITHUB_SHA