Compare commits

...

5 Commits

Author SHA1 Message Date
Klop233
6ebdd3390f update CI 2024-04-03 21:09:03 +08:00
Klop233
9951540a4a update CI 2024-04-03 20:56:39 +08:00
Klop233
8cdd79c1ac Merge remote-tracking branch 'origin/ver/1.20.4' into ver/1.20.4 2024-04-03 20:53:06 +08:00
Klop233
d92fb15713 update CI 2024-04-03 20:52:36 +08:00
Klop233
971b0abca6 Update build_1_20_4.yml 2024-04-03 20:49:37 +08:00
5 changed files with 184 additions and 47 deletions

View File

@@ -18,46 +18,87 @@ permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3
- name: Set up git
run: git config --global user.email "noreply@github.com" && git config --global user.name "ci"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod 777 ./gradlew
- name: Setup project
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: applyPatches
- name: Build project to paperclip jar
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: createReobfPaperclipJar
- name: Capture build artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
- name: Publish All
run: |
echo "GITHUB_USERNAME=LuminolCI" >> $GITHUB_ENV
export GITHUB_USERNAME=LuminolCI
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./gradlew publish -PpublishDevBundle=true
- name: Rename jar file
run: mv build/libs/luminol-paperclip-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-paperclip.jar
- name: Release Artifacts
uses: svenstaro/upload-release-action@v2
with:
release_name: "Luminol MC1.20.4 - ${{ github.event.repository.updated_at}}"
tag: "1.20.4-${{ github.run_id }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
file: "build/libs/luminol-1.20.4-paperclip.jar"
file_glob: true
prerelease: true
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Setup Git Config
run: |
git config --global user.email "ci@leavesmc.top"
git config --global user.name "Leaves CI"
- name: Apply Patches
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: applyPatches
- name: Create Paperclip Jar
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: createReobfPaperclipJar
- name: Publish API
continue-on-error: true
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: publish -PleavesUsername=${{ secrets.REPO_USERNAME }} -PleavesPassword=${{ secrets.REPO_PASSWORD }}
- name: Create Configuration
continue-on-error: true
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: createLeavesConfig
- name: Push Configuration
continue-on-error: true
run: |
mkdir --parents "$HOME/.ssh"
ssh-keyscan -H "github.com" > "$HOME/.ssh/known_hosts"
echo "${{ secrets.CONFIG_DEPLOY_KEY }}" > "$HOME/.ssh/deploy.key"
chmod 400 "$HOME/.ssh/deploy.key"
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/deploy.key"
git clone git@github.com:LeavesMC/Configuration.git configuration -b Leaves
cp run/leaves.yml configuration/leaves.yml -f
cd configuration
git add leaves.yml
git commit leaves.yml -m "$(date -u +"%Y-%m-%dT%H:%M:%SZ")
https://github.com/LeavesMC/Leaves/commit/$(cd .. && git rev-parse HEAD)"
git push origin HEAD:Leaves
- name: Get Release Info
run: sh scripts/GetReleaseInfo.sh
- name: Create Release
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
uses: ncipollo/release-action@v1.12.0
with:
artifacts: ${{ env.jar }}
bodyFile: ${{ env.info }}
tag: ${{ env.tag }}
name: ${{ env.name }}
prerelease: ${{ env.pre }}
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: ${{ env.make_latest }}
- name: Delete Draft Releases
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Github Releases To Discord
# continue-on-error: true
# uses: tsickert/discord-webhook@v5.3.0
# with:
# webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
# raw-data: ${{ env.discordmes }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.jar }}
path: ${{ env.jar }}
- name: Push to Api
continue-on-error: true
if: "!contains(github.event.commits[0].message, '[release-skip]')"
env:
secret: ${{ secrets.API_PUSH_TOKEN }}
secret_v2: ${{ secrets.API_V2_PUSH_TOKEN }}
tag: ${{ env.tag }}
run: sh scripts/PushToAPI.sh

View File

@@ -52,11 +52,6 @@ dependencies {
QQ群`368632360` | QQ频道[点击加入](https://pd.qq.com/s/eq9krf9j) | Telegram[点击加入](https://t.me/LuminolMC)
> [!WARNING]
> **此项目与Leaves无关。不要向Leaves报告任何有关协议支持的错误因为协议支持已经重构**
## 关于 Issue
当您遇到任何问题时,请向我们提问,我们将尽力解决,但请记得清楚地描述您的问题并提供足够的日志等信息。
## 贡献代码
可[查看 Contributing](./docs/CONTRIBUTING.md)
@@ -74,3 +69,7 @@ QQ群`368632360` | QQ频道[点击加入](https://pd.qq.com/s/eq9krf9j)
<img alt="Star历史表" src="https://api.star-history.com/svg?repos=LuminolMC/Luminol%2CLuminolMC/LightingLuminol&type=Date" />
</picture>
</a>
> [!WARNING]
> **此项目与Leaves无关。不要向Leaves报告任何有关协议支持的错误因为协议支持已经重构**
>

View File

@@ -7,3 +7,10 @@ org.gradle.caching = true
org.gradle.parallel = true
org.gradle.vfs.watch = false
org.gradle.jvmargs = -Xmx3G
# adapt Leaves API Push
mcVersion=1.20.4
packageVersion=1_20_R3
preVersion=false
updatingMinecraft=false

58
scripts/GetReleaseInfo.sh Normal file
View File

@@ -0,0 +1,58 @@
sha1() {
sha1sum $1 | awk '{print $1}'
}
md5() {
md5sum $1 | awk '{print $1}'
}
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
commitid=$(git log --pretty='%h' -1)
mcversion=$(prop mcVersion)
gradleVersion=$(prop version)
preVersion=$(prop preVersion)
tagid="$mcversion-$commitid"
jarName="luminol-$mcversion.jar"
luminolid="Luminol-$commitid"
releaseinfo="releaseinfo.md"
#discordmes="discordmes.json"
make_latest=$([ $preVersion = "true" ] && echo "false" || echo "true")
rm -f $discordmes
rm -f $releaseinfo
mv build/libs/Luminol-paperclip-$gradleVersion-reobf.jar $jarName
echo "name=$luminolid" >> $GITHUB_ENV
echo "tag=$tagid" >> $GITHUB_ENV
echo "jar=$jarName" >> $GITHUB_ENV
echo "info=$releaseinfo" >> $GITHUB_ENV
#echo "discordmes=$discordmes" >> $GITHUB_ENV
echo "pre=$preVersion" >> $GITHUB_ENV
echo "make_latest=$make_latest" >> $GITHUB_ENV
echo "$luminolid [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/$tagid/total?color=0)](https://github.com/LuminolMC/Luminol/releases/download/$tagid/$jarName)" >> $releaseinfo
echo "=====" >> $releaseinfo
echo "" >> $releaseinfo
if [ $preVersion = "true" ]; then
echo "> This is an early, experimental build. It is only recommended for usage on test servers and should be used with caution." >> $releaseinfo
echo "> **Backups are mandatory!**" >> $releaseinfo
echo "" >> $releaseinfo
fi
echo "### Commit Message" >> $releaseinfo
number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l)
echo "$(git log --pretty='> [%h] %s' -$number)" >> $releaseinfo
echo "" >> $releaseinfo
echo "### Checksum" >> $releaseinfo
echo "| File | $jarName |" >> $releaseinfo
echo "| ---- | ---- |" >> $releaseinfo
echo "| MD5 | `md5 $jarName` |" >> $releaseinfo
echo "| SHA1 | `sha1 $jarName` |" >> $releaseinfo
#echo -n "{\"content\":\"Leaves New Release\",\"embeds\":[{\"title\":\"$leavesid\",\"url\":\"https://github.com/LeavesMC/Leaves/releases/tag/$tagid\",\"fields\":[{\"name\":\"Changelog\",\"value\":\"" >> $discordmes
#echo -n $(git log --oneline --pretty='> [%h] %s\\n' -$number) >> $discordmes
#echo "\",\"inline\":true}]}]}" >> $discordmes

View File

@@ -0,0 +1,32 @@
sha256() {
sha256sum $1 | awk '{print $1}'
}
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
echo "$tag"
project_id="luminol"
project_name="luminol"
mcversion=$(prop mcVersion)
ctime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
pre=$(prop preVersion)
if [ $pre = "true" ]; then
channel="experimental"
else
channel="default"
fi
promoted=false
# shellcheck disable=SC2046
number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l)
changes=$(git log --pretty='%H<<<%s>>>' -"$number" | sed ':a;N;$!ba;s/\n//g')
jar_name="leaves-$mcversion.jar"
jar_sha256=`sha256 $jar_name`
# v1
#curl --location --request POST "https://api.leavesmc.org/new_release" --header "Content-Type: application/json" --data-raw "{\"project_id\":\"$project_id\",\"project_name\":\"$project_name\",\"version\":\"$mcversion\",\"time\":\"$ctime\",\"channel\":\"$channel\",\"promoted\":$promoted,\"changes\":\"$changes\",\"downloads\":{\"application\":{\"name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"url\":\"https://github.com/LeavesMC/Leaves/releases/download/$tag/$jar_name\"}},\"secret\":\"$secret\"}"
#curl --location --request POST "https://api.leavesmc.org/upload_file" -F "file=@$jar_name" -F "filename=$jar_name" -F "filehash=$jar_sha256" -F "secret=$secret"
# v2
curl --location --request POST "https://api.luminolmc.com/v2/commit/build" --header "Content-Type: application/json" --header "Authentication: Bearer $secret_v2" --data-raw "{\"project_id\":\"$project_id\",\"version\":\"$mcversion\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"tag\":\"$tag\"}"