Remove multi-version wrappers and 1.12.2 module #134
Workflow file for this run
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: Java CI with Gradle - Nightly | |
| #on: | |
| # schedule: | |
| # - cron: '0 17 * * *' | |
| # workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get latest commit hash | |
| id: current | |
| run: | | |
| echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get last published commit hash | |
| id: last | |
| run: | | |
| last_sha=$(curl -s "https://service.fpsmaster.top/api/github/latest/commit?branch=${GITHUB_REF}") | |
| echo "sha=$last_sha" >> $GITHUB_OUTPUT | |
| - name: Check if new commit exists | |
| id: check | |
| run: | | |
| if [ "${{ steps.current.outputs.sha }}" = "${{ steps.last.outputs.sha }}" ]; then | |
| echo "No new commit since last build. Skipping." | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "New commit detected. Continuing." | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Stop if no new commit | |
| if: steps.check.outputs.skip == 'true' | |
| run: exit 0 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
| with: | |
| gradle-version: '8.6' | |
| - name: Build with Gradle Wrapper | |
| run: | | |
| chmod +x ./v1.8.9/gradlew | |
| cd v1.8.9 | |
| ./gradlew build | |
| - name: Upload v1.8.9 artifacts | |
| uses: actions/[email protected] | |
| with: | |
| name: v1.8.9 | |
| path: v1.8.9/build/libs/ | |
| - name: Upload artifact | |
| run: | | |
| cd v1.8.9 | |
| plain_version=$(awk -F'=' '/^version[[:space:]]*=/ {print $2}' gradle.properties | tr -d '[:space:]') | |
| sha=$(git rev-parse --short=6 HEAD) | |
| date=$(date -u +%Y%m%d) | |
| version="${plain_version}-nightly-${sha}" | |
| filename="fpsmaster-nightly-${date}.zip" | |
| mkdir -p build/libs | |
| cd build/libs | |
| export JAR=$(find . -name "*.jar") | |
| mkdir -p zip | |
| cp "$JAR" zip/fpsmaster.jar | |
| cd zip | |
| zip -r "$filename" * | |
| # 创建存储目录 | |
| RESPONSE=$(curl --location --request POST "https://api.kstore.space/api/v1/file/create" \ | |
| --header "X-GitHub-Event: workflow_run" \ | |
| --header "User-Agent: Apifox/1.0.0 (https://apifox.com)" \ | |
| --form "access_token=${{ secrets.OSS }}" \ | |
| --form "fileId=0" \ | |
| --form "name=action-${{ github.sha }}") | |
| DIR_ID=$(echo "$RESPONSE" | jq -r '.data.id') | |
| echo "DirectoryId: $DIR_ID" | |
| # 上传文件 | |
| UPLOAD_RESPONSE=$(curl --location --request POST "https://upload.kstore.space/upload/$DIR_ID?access_token=${{ secrets.OSS }}" \ | |
| -F "file=@$filename") | |
| DOWNLOAD_URL=$(echo "$UPLOAD_RESPONSE" | jq -r '.data.downloadUrl') | |
| FILE_ID=$(echo "$UPLOAD_RESPONSE" | jq -r '.data.id') | |
| echo "FileId: $FILE_ID" | |
| echo "URL: $DOWNLOAD_URL" | |
| # 设为直接下载 | |
| RESPONSE=$(curl --location --request POST "https://api.kstore.cc/api/v1/file/direct?access_token=${{ secrets.OSS }}" \ | |
| --form "fileId=$FILE_ID" \ | |
| --form "isDirect=1") | |
| echo "$RESPONSE" | |
| echo "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| # 推送版本信息 | |
| curl --get \ | |
| --data-urlencode "key=${{ secrets.API_KEY }}" \ | |
| --data-urlencode "commit=${{ github.sha }}" \ | |
| --data-urlencode "branch=${{ github.ref }}" \ | |
| --data-urlencode "version=$version" \ | |
| --data-urlencode "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ | |
| --data-urlencode "link=$DOWNLOAD_URL" \ | |
| --data-urlencode "release=false" \ | |
| "https://service.fpsmaster.top/api/github/push" |