Nightly Build #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nightly Build | |
| on: | |
| schedule: | |
| - cron: '0 20 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Validate Gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Setup JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'zulu' | |
| - name: Make Gradle wrapper executable | |
| run: chmod +x ./gradlew | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Get current date | |
| run: | | |
| echo "BUILD_TIME=$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV | |
| - name: Prepare CI Artifacts | |
| run: | | |
| mkdir -p build/ci-artifacts | |
| find fabric/build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-sources.jar' -exec cp {} build/ci-artifacts/ \; | |
| find neoforge/build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-sources.jar' -exec cp {} build/ci-artifacts/ \; | |
| find common/build/libs -maxdepth 1 -type f -name '*.jar' -exec cp {} build/ci-artifacts/ \; | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: build/ci-artifacts/*.jar | |
| if-no-files-found: warn | |
| - uses: "marvinpinto/action-automatic-releases@latest" | |
| if: ${{ runner.os == 'Linux' }} | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "nightly" | |
| title: "Nightly Build (${{ env.BUILD_TIME }})" | |
| prerelease: true | |
| files: | | |
| build/ci-artifacts/*.jar | |
| - name: Update Nightly Release Notes | |
| if: ${{ runner.os == 'Linux' }} | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| run: | | |
| { | |
| echo "Nightly Build (${{ env.BUILD_TIME }})" | |
| echo | |
| echo "English:" | |
| echo "Regular users only need to download the non-sources Fabric or NeoForge jar for their runtime environment." | |
| echo "The common artifacts are intended for addon development." | |
| echo | |
| echo "中文:" | |
| echo "普通用户只需要根据自己的运行环境下载不带 sources 的 Fabric 或 NeoForge 版本。" | |
| echo "common 产物用于 addon 开发。" | |
| } > "$RUNNER_TEMP/nightly-release-notes.md" | |
| gh release edit nightly --notes-file "$RUNNER_TEMP/nightly-release-notes.md" |