Skip to content

ci: try to fix nightly build x3 #1160

ci: try to fix nightly build x3

ci: try to fix nightly build x3 #1160

Workflow file for this run

name: Allay
on:
push:
branches: [ "master" ]
paths:
- .github/workflows/gradle.yml
- gradle/libs.versions.toml
- api/**
- server/**
- data/**
pull_request:
paths:
- .github/workflows/gradle.yml
- gradle/libs.versions.toml
- api/**
- server/**
- data/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup WARP
uses: fscarmen/[email protected]
if: contains(github.ref_name, 'master')
with:
stack: dual
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
cache-overwrite-existing: true
cache-read-only: false
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- name: Make Gradle Wrapper Script Executable
run: chmod +x gradlew
- name: Build
run: ./gradlew build
- name: Generate Coverage Reports
if: success()
run: ./gradlew jacocoTestReport
- name: Upload Coverage Reports to Codecov
uses: codecov/[email protected]
if: success()
with:
directory: .jacoco/test/
token: ${{ secrets.CODECOV_TOKEN }}
- name: Find Shaded Jar
id: vars
run: |
SHADED_JAR=$(find server/build/libs -name "allay-server-*-shaded.jar" -print -quit)
echo "SHADED_JAR=$SHADED_JAR" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: success()
with:
name: allay-server
path: server/build/libs/${{ steps.vars.outputs.SHADED_JAR }}
- name: Publish to JitPack
uses: fjogeleit/http-request-action@v1
if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
with:
url: 'https://jitpack.io/#AllayMC/Allay/master-SNAPSHOT'
method: 'GET'
- name: Set Tag
if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -f -a nightly -m "Nightly build"
git push origin -f --follow-tags nightly
- name: Update Nightly Build
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/AllayMC/Allay/releases/185111149/assets{?name,label}
release_id: 185111149
asset_path: ./server/build/libs/${{ steps.vars.outputs.SHADED_JAR }}
asset_name: allay-nightly-$$.zip
asset_content_type: application/zip
max_releases: 1
# TODO: Replace the following two tasks with a better method
- name: Copy Jar to Test Server
id: deploy-jar
uses: appleboy/scp-action@master
if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
continue-on-error: true
with:
host: ${{ secrets.TEST_SERVER_HOST }}
username: ${{ secrets.TEST_SERVER_USER_NAME }}
port: ${{ secrets.TEST_SERVER_PORT }}
key: ${{ secrets.TEST_SERVER_SSH_KEY }}
passphrase: ${{ secrets.TEST_SERVER_SSH_KEY_PASSPHRASE }}
source: server/build/libs/${{ steps.vars.outputs.SHADED_JAR }}
strip_components: 3
target: "/root/allaymc/tmp"
- name: Restart Test Server
uses: appleboy/ssh-action@master
if: steps.deploy-jar.outcome == 'success' && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
continue-on-error: true
with:
host: ${{ secrets.TEST_SERVER_HOST }}
username: ${{ secrets.TEST_SERVER_USER_NAME }}
key: ${{ secrets.TEST_SERVER_SSH_KEY }}
passphrase: ${{ secrets.TEST_SERVER_SSH_KEY_PASSPHRASE }}
port: ${{ secrets.TEST_SERVER_PORT }}
command_timeout: 60s
script: |
cd /root/allaymc
./restart.sh
exit