|
1 | 1 | name: CI |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - main |
6 | 7 | workflow_dispatch: |
| 8 | + schedule: |
| 9 | + - cron: '0 4 * * *' # Runs daily at 04:00 UTC |
| 10 | + |
7 | 11 | permissions: |
8 | 12 | packages: write |
9 | 13 | contents: write |
10 | 14 |
|
11 | 15 | env: |
12 | | - STUBGEN_BUILD_NUM: 12 |
| 16 | + STUBGEN_BUILD_NUM: 13 |
| 17 | + MINECRAFT_VERSION: 1.21.5 |
13 | 18 | ADDITIONAL_DEFINITION_URLS: | |
14 | 19 | https://raw.githubusercontent.com/LuaLink/LuaLinkV2/master/src/main/resources/lua/script.lua |
15 | 20 | https://raw.githubusercontent.com/LuaLink/LuaLinkV2/master/src/main/resources/lua/scheduler.lua |
16 | 21 | SOURCES_JAR_URLS: | |
17 | | - https://repo.papermc.io/repository/maven-public/io/papermc/paper/paper-api/1.21.5-no-moonrise-SNAPSHOT/paper-api-1.21.5-no-moonrise-20250328.181903-5-sources.jar |
18 | 22 | https://repo.papermc.io/repository/maven-public/net/kyori/adventure-text-logger-slf4j/4.21.0/adventure-text-logger-slf4j-4.21.0-sources.jar |
19 | 23 | https://repo.papermc.io/repository/maven-public/net/kyori/adventure-text-minimessage/4.11.0-SNAPSHOT/adventure-text-minimessage-4.11.0-20220309.063149-7-sources.jar |
20 | 24 | https://repo.papermc.io/repository/maven-public/net/kyori/adventure-text-serializer-gson/4.21.0/adventure-text-serializer-gson-4.21.0-sources.jar |
21 | 25 | https://repo.papermc.io/repository/maven-public/net/kyori/adventure-platform-bukkit/4.1.1-SNAPSHOT/adventure-platform-bukkit-4.1.1-20220228.221434-1.jar |
22 | 26 | https://repo.papermc.io/repository/maven-public/net/kyori/adventure-api/4.21.0/adventure-api-4.21.0-sources.jar |
| 27 | +
|
23 | 28 | jobs: |
24 | 29 | build: |
25 | 30 | runs-on: ubuntu-latest |
26 | 31 | if: "!contains(github.event.commits[0].message, '[ci-skip]')" |
27 | 32 | steps: |
28 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
29 | 35 | - name: Set up JDK 21 |
30 | | - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4 |
| 36 | + uses: actions/setup-java@v4 |
31 | 37 | with: |
32 | 38 | java-version: 21 |
33 | 39 | distribution: 'adopt' |
| 40 | + |
34 | 41 | - name: Download LuaLink/LuaStubGen JAR |
35 | 42 | run: | |
36 | | - # Download to a temporary location |
37 | 43 | mkdir -p $RUNNER_TEMP/stubgen |
38 | 44 | curl -L -o $RUNNER_TEMP/stubgen/LuaStubGen.jar https://github.com/LuaLink/LuaStubGen/releases/download/$STUBGEN_BUILD_NUM/LuaStubGen-1.0-SNAPSHOT-all.jar |
| 45 | + |
| 46 | + - name: Install xmllint |
| 47 | + run: sudo apt-get update && sudo apt-get install -y libxml2-utils |
| 48 | + |
| 49 | + - name: Resolve Paper API Snapshot Sources JAR |
| 50 | + id: resolve-paper |
| 51 | + run: | |
| 52 | + METADATA_URL="https://repo.papermc.io/repository/maven-public/io/papermc/paper/paper-api/${MINECRAFT_VERSION}-R0.1-SNAPSHOT/maven-metadata.xml" |
| 53 | + echo "Fetching metadata from $METADATA_URL" |
| 54 | + curl -s "$METADATA_URL" -o metadata.xml |
| 55 | +
|
| 56 | + VERSION=$(xmllint --xpath "string(//snapshotVersion[classifier='sources']/value)" metadata.xml) |
| 57 | + echo "Resolved version: $VERSION" |
| 58 | +
|
| 59 | + JAR_URL="https://repo.papermc.io/repository/maven-public/io/papermc/paper/paper-api/${MINECRAFT_VERSION}-R0.1-SNAPSHOT/paper-api-${VERSION}-sources.jar" |
| 60 | + echo "Resolved JAR URL: $JAR_URL" |
| 61 | +
|
| 62 | + echo "PAPER_API_SOURCES_URL=$JAR_URL" >> $GITHUB_ENV |
| 63 | +
|
39 | 64 | - name: Download Source JARs |
40 | 65 | run: | |
41 | | - # Download source JARs |
42 | 66 | mkdir -p $RUNNER_TEMP/sources |
43 | | - IFS=$'\n' # Split by newline to handle multiple URLs |
| 67 | +
|
| 68 | + # Download Paper API sources |
| 69 | + curl -L -o $RUNNER_TEMP/sources/paper-api-sources.jar "$PAPER_API_SOURCES_URL" |
| 70 | +
|
| 71 | + # Download other JARs |
| 72 | + IFS=$'\n' |
44 | 73 | for url in $SOURCES_JAR_URLS; do |
45 | 74 | filename=$(basename "$url") |
46 | 75 | curl -L -o $RUNNER_TEMP/sources/"$filename" "$url" |
47 | 76 | done |
| 77 | +
|
| 78 | + - name: Clean previous Paper definitions |
| 79 | + run: rm -rf library/paper |
| 80 | + |
48 | 81 | - name: Generate Lua definitions |
49 | 82 | run: | |
50 | | - # Generate Lua definitions |
51 | 83 | mkdir -p library/paper |
52 | | - # Get a space separated list of JAR files from the downloaded source JARs |
53 | 84 | jar_files=$(ls $RUNNER_TEMP/sources/*.jar | tr '\n' ' ') |
54 | 85 | java -jar $RUNNER_TEMP/stubgen/LuaStubGen.jar --output-dir=library/paper $jar_files |
| 86 | +
|
55 | 87 | - name: Download additional definitions |
56 | 88 | run: | |
57 | | - # Download additional definitions |
58 | 89 | mkdir -p library/lualink |
59 | | - IFS=$'\n' # Split by newline to handle multiple URLs |
| 90 | + IFS=$'\n' |
60 | 91 | for url in $ADDITIONAL_DEFINITION_URLS; do |
61 | 92 | filename=$(basename "$url") |
62 | 93 | curl -L -o library/lualink/"$filename" "$url" |
63 | 94 | done |
| 95 | +
|
64 | 96 | - name: Commit and push changes |
65 | 97 | run: | |
66 | | - # Commit and push changes |
67 | 98 | git config --local user.name "GitHub Action" |
68 | | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" # Default GitHub Actions bot email |
| 99 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
69 | 100 | git add library/paper |
70 | 101 | git add library/lualink |
71 | 102 | git commit -m "Update Lua definitions" || echo "No changes to commit" |
|
0 commit comments