| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- name: Publish Mah
- on:
- push:
- tags: [ 'v*' ]
- jobs:
- build:
- name: Publish to Maven Central
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Set up JDK 11
- uses: actions/setup-java@v1
- with:
- java-version: 11
- - name: Grant Execute Permission for gradlew
- run: chmod +x gradlew
- - run: ./gradlew mirai-api-http:checkMavenCentralPublication --info --scan
- env:
- PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- - run: ./gradlew mirai-api-http-spi:checkMavenCentralPublication --info --scan
- env:
- PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- - name: Build with Gradle
- run: ./gradlew buildCiJar
- - name: Build SPI
- run: ./gradlew buildSpi
- - name: Publish to Maven Central
- run: ./gradlew mirai-api-http:publish --info --scan
- env:
- PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- - name: Publish SPI to Maven Central
- run: ./gradlew mirai-api-http-spi:publish --info --scan
- env:
- PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- - name: Get Tag
- id: tag
- run: |
- tag=$(echo ${{ github.ref }} | cut -dv -f2)
- echo "tag=$tag" >> $GITHUB_OUTPUT
- - name: Generate Line Temp File
- run: "cat CHANGELOG.md | grep -n '## \\\\' | cut -d: -f1 | head -n 2 >> line.tmp"
- - name: Generate Release Log
- run: "cat CHANGELOG.md | head -n $((`tail -n 1 line.tmp`-1)) | tail -n +`head -n 1 line.tmp` >> release.log"
- - name: Create Release
- id: create_release
- uses: softprops/action-gh-release@v1
- with:
- tag_name: ${{ github.ref }}
- name: mirai-api-http-${{ steps.tag.outputs.tag }}
- body_path: release.log
- draft: false
- prerelease: false
- files: |
- ./mirai-api-http/build/ci/mirai-api-http-${{ steps.tag.outputs.tag }}.mirai2.jar
- - name: Clone Mirai-Repo
- uses: actions/checkout@v3
- with:
- repository: project-mirai/mirai-repo-mirror
- ref: master
- token: ${{ secrets.MAMOEBOT_TOKEN }}
- path: ./mirai-repo-mirror
- - name: Modify package.json
- uses: ./.github/actions/modify-package-json
- with:
- defaultChannel: stable-v2
- version: ${{ steps.tag.outputs.tag }}
- srcPath: mirai-repo-mirror/net/mamoe/mirai-api-http/package.json
- destPath: .github/package.json
- - name: Move package.json
- run: |
- cp .github/package.json mirai-repo-mirror/net/mamoe/mirai-api-http/package.json
- - name: Create PR for Mirai-Repo
- uses: peter-evans/create-pull-request@v4
- with:
- token: ${{ secrets.MAMOEBOT_TOKEN }}
- commit-message: 'update: mirai-api-http ${{ steps.tag.outputs.tag }}'
- title: 'update: mirai-api-http ${{ steps.tag.outputs.tag }}'
- branch: create-pull-request/mah-update-version
- delete-branch: true
- path: ./mirai-repo-mirror
- base: master
|