This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
create release #88
This file contains 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: "create release" | |
on: | |
workflow_dispatch: | |
inputs: | |
v: | |
required: true | |
description: version tag | |
type: string | |
pre: | |
required: true | |
description: pre-release | |
default: false | |
type: boolean | |
# skipTest: | |
# description: skip-test | |
# type: boolean | |
# default: false | |
# required: false | |
jobs: | |
build-libLoader-msvc-4-windows: | |
runs-on: windows-2019 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up MSVC | |
uses: ilammy/[email protected] | |
with: | |
arch: amd64 | |
vsversion: 2019 | |
- name: build with gcc libLoader | |
run: ./scripts/WIN/cppBuilds.bat libLoader | |
- name: copy out | |
run: copy ./cpp/build/Release/*.dll | |
- name: upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libLoaderdll | |
path: | | |
./*.dll | |
build-libLoader-gcc-4-linux: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up GCC | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: 9 | |
platform: x64 | |
- name: print glibc version | |
run: ldd --version | |
- name: build with gcc libLoader | |
run: ./scripts/LINUX/cppBuilds.sh libLoader | |
- name: copy out | |
run: cp ./cpp/build/*.so ./ | |
- name: upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libLoaderso | |
path: | | |
./*.so | |
push-single-include-2-template: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
path: main | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
path: template | |
repository: Nambers/MiraiCP-template | |
ref: main | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: generate single headers | |
env: | |
cc: gcc | |
cxx: g++ | |
run: cd main && mkdir cpp/build && cd cpp/build && cmake -DGOOGLE_TEST=OFF .. && make generateSingleHeaders | |
- name: replace single header(1/2) | |
run: cat main/cpp/single_include/MiraiCP.hpp > template/single_include/MiraiCP/MiraiCP.hpp | |
- name: replace single header(2/2) | |
run: cat main/cpp/single_include/MiraiCP.cpp > template/single_include/MiraiCP/MiraiCP.cpp | |
- name: mv | |
run: mv ./template/.git ./.git | |
- name: Push | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: [email protected]:Nambers/MiraiCP-template.git | |
BRANCH: main # The branch name where you want to push the assets | |
FOLDER: ./template # The directory where your assets are generated | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
MESSAGE: ${{ github.event.inputs.v }} # The commit message | |
publish-release: | |
needs: [build-libLoader-gcc-4-linux, build-libLoader-msvc-4-windows] | |
runs-on: ubuntu-20.04 | |
steps: | |
# - name: loadTest | |
# if: ${{ !github.event.inputs.skipTest }} | |
# uses: ./.github/workflows/loadTest.yml | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: permission | |
run: chmod -R 777 * | |
- name: Set up JDK 15 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '15' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
- name: Build plugin | |
run: cd ./kotlin/ && ./gradlew MiraiCP-plugin:buildPlugin --warning-mode all --info --stacktrace | |
- name: Build loader | |
run: cd ./kotlin/ && ./gradlew MiraiCP-loader:shadowJar --warning-mode all --info --stacktrace | |
- name: get change log | |
run: "grep -n -i \"## v\" CHANGELOG.md | head -n2 | cut -d: -f1 >> line.tmp" | |
- name: get change log2 | |
run: cat CHANGELOG.md | head -n $((`tail -n 1 line.tmp`-1)) | tail -n +`head -n 1 line.tmp` >> release.log | |
- name: show | |
run: cat release.log | |
- uses: actions/download-artifact@v3 | |
with: | |
name: libLoaderso | |
path: ./ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: libLoaderdll | |
path: ./ | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: ./kotlin/loader/build/libs/MiraiCP-loader-*.jar,./kotlin/plugin/build/mirai/MiraiCP-plugin-*.mirai2.jar,./libLoader.dll,./libLoader.so | |
bodyfile: release.log | |
tag: ${{ github.event.inputs.v }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: ${{ github.event.inputs.pre }} |