Skip to content

[Multiversion] Support for 1.20.40 #1206

[Multiversion] Support for 1.20.40

[Multiversion] Support for 1.20.40 #1206

Workflow file for this run

name: Java CI with Maven
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build projects
run: mvn -B package --file pom.xml
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v4
with:
name: Nukkit-MOT
path: staging
# 生成信息
- name: Get Short SHA
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Format ChangeLog
id: get-changelog
if: success() && github.event_name == 'push' && github.repository == 'MemoriesOfTime/Nukkit-MOT' && contains(github.ref_name, 'master')
run: echo "changelog=${{ github.event.commits[0].message }}" >> $GITHUB_OUTPUT
- name: Get Time
id: time
uses: nanzm/[email protected]
if: github.repository == 'MemoriesOfTime/Nukkit-MOT' && contains(github.ref_name, 'master')
with:
timeZone: 8
format: 'YYYY/MM/DD-HH:mm:ss'
# 推送到minebbs
- name: Update MineBBS infomation
uses: fjogeleit/http-request-action@v1
if: success() && github.event_name == 'push' && github.repository == 'MemoriesOfTime/Nukkit-MOT' && contains(github.ref_name, 'master')
with:
url: 'https://api.minebbs.com/api/openapi/v1/resources/5934/update'
method: 'POST'
customHeaders: '{"Authorization": "Bearer ${{ secrets.MINEBBS_API_KEY }}"}'
contentType: 'application/json'
data: '{"title": "${{ github.ref_name }}-${{ steps.vars.outputs.sha_short }}", "description": "${{ steps.get-changelog.outputs.changelog }}", "new_version": "${{ steps.time.outputs.time }}", "file_url": "https://motci.cn/job/Nukkit-MOT/"}'
escapeData: 'true'
preventFailureOnNoResponse: 'true'
ignoreStatusCodes: '400,404,401,403,500,502,503,504'