diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..255713b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: ci + +on: + workflow_dispatch: + push: + branches: + - "**" + paths: + - ".github/workflows/ci.yml" + - "src/**" + - "*.sln" + - "*.props" + tags: + - "v*" + + pull_request: + branches: + - "**" + paths: + - ".github/workflows/ci.yml" + - "src/**" + - "*.sln" + - "*.props" + +jobs: + meta: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: meta + run: | + is_release=${{ startsWith(github.ref, 'refs/tags/v') }} + tag=$(git describe --tags --match "v*" ${{ github.ref }} || true) + if [[ $tag != v* ]]; then + tag=$(date "+v0.0.0-%y%m%d-$(git rev-parse --short HEAD)") + fi + if ! $($is_release) ; then + prefix=${tag%-*-*} + suffix=${tag#$prefix-} + next=${prefix##*.} + ((++next)) + prefix=${prefix%.*} + tag="$prefix.$next-Preview.$suffix" + fi + echo tag=$tag | tee -a $GITHUB_OUTPUT + echo version=${tag#v} | tee -a $GITHUB_OUTPUT + echo is_release=$is_release | tee -a $GITHUB_OUTPUT + outputs: + tag: ${{ steps.meta.outputs.tag }} + version: ${{ steps.meta.outputs.version }} + is_release: ${{ steps.meta.outputs.is_release }} + + publish: + needs: [meta] + strategy: + matrix: + project: [MBA.Cli] + os: [win, linux, osx] + arch: [x64, arm64] + suffix: [-single-cut] + dotnet: [ '7.0' ] + fail-fast: false + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + PUBLISH_NAME: ${{ matrix.project }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix }}-${{ needs.meta.outputs.tag }} + PUBLISH_PATH: ./Publish #./Publish/${{ matrix.project }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix }}/ + CSPROJ_PATH: ./src/${{ matrix.project }}/${{ matrix.project }}.csproj + PUBXML_PATH: ./src/${{ matrix.project }}/Properties/PublishProfiles/${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix }}.pubxml + + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet }} + cache: true + cache-dependency-path: '**/packages.lock.json' + - run: dotnet restore --locked-mode + + - run: dotnet publish ${{ env.CSPROJ_PATH }} --no-restore -p:Version=${{ needs.meta.outputs.version }} -p:PublishProfile=${{ env.PUBXML_PATH }} + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: ${{ env.PUBLISH_NAME }} + path: ${{ env.PUBLISH_PATH }} + + - name: Pack + if: ${{ needs.meta.outputs.is_release == 'true' }} + working-directory: ${{ env.PUBLISH_PATH }} + run: 7z a -r ../${{ env.PUBLISH_NAME }}.zip ./* + + - uses: softprops/action-gh-release@v1 + if: ${{ needs.meta.outputs.is_release == 'true' }} + with: + body_path: CHANGELOG.md + prerelease: true + files: ${{ env.PUBLISH_NAME }}.zip + tag_name: ${{ needs.meta.outputs.tag }} diff --git a/.gitignore b/.gitignore index 99621a4..d216122 100644 --- a/.gitignore +++ b/.gitignore @@ -186,7 +186,7 @@ publish/ *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted -*.pubxml +# *.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to diff --git a/Directory.Build.props b/Directory.Build.props index dbbaad9..093e823 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,10 @@ + net7.0 + linux-arm64;linux-x64;osx-arm64;osx-x64;win-arm64;win-x64 + true + embedded enable enable @@ -11,4 +15,18 @@ + + + + $([System.DateTime]::Now.Year) + + + + + 1.0.0-dev + MAA Team + MAA Team + MAA Assistant Arknights + Copyright © 2021-$(CurrentYear) MAA Team and Contributers. All rights reserved. + diff --git a/Directory.Packages.props b/Directory.Packages.props index 7502756..6fcff7c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,14 +1,15 @@ - - true - - - - - - - - - - - \ No newline at end of file + + true + true + + + + + + + + + + + diff --git a/src/MBA.Cli/MBA.Cli.csproj b/src/MBA.Cli/MBA.Cli.csproj index 5e3a4ce..14ad012 100644 --- a/src/MBA.Cli/MBA.Cli.csproj +++ b/src/MBA.Cli/MBA.Cli.csproj @@ -1,5 +1,4 @@ - Exe ..\..\assets\logo.ico @@ -8,5 +7,4 @@ - diff --git a/src/MBA.Cli/Properties/PublishProfiles/linux-arm64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/linux-arm64-single-cut.pubxml new file mode 100644 index 0000000..d7b89d9 --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/linux-arm64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + ARM64 + linux-arm64 + ..\..\Publish\MBA.Cli-linux-arm64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/Properties/PublishProfiles/linux-x64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/linux-x64-single-cut.pubxml new file mode 100644 index 0000000..15db8dc --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/linux-x64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + x64 + linux-x64 + ..\..\Publish\MBA.Cli-linux-x64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/Properties/PublishProfiles/osx-arm64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/osx-arm64-single-cut.pubxml new file mode 100644 index 0000000..0da503f --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/osx-arm64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + ARM64 + osx-arm64 + ..\..\Publish\MBA.Cli-osx-arm64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/Properties/PublishProfiles/osx-x64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/osx-x64-single-cut.pubxml new file mode 100644 index 0000000..027bee0 --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/osx-x64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + x64 + osx-x64 + ..\..\Publish\MBA.Cli-osx-x64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/Properties/PublishProfiles/win-arm64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/win-arm64-single-cut.pubxml new file mode 100644 index 0000000..f6cc844 --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/win-arm64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + ARM64 + win-arm64 + ..\..\Publish\MBA.Cli-win-arm64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/Properties/PublishProfiles/win-x64-single-cut.pubxml b/src/MBA.Cli/Properties/PublishProfiles/win-x64-single-cut.pubxml new file mode 100644 index 0000000..95a6ba9 --- /dev/null +++ b/src/MBA.Cli/Properties/PublishProfiles/win-x64-single-cut.pubxml @@ -0,0 +1,16 @@ + + + + + x64 + win-x64 + ..\..\Publish\MBA.Cli-win-x64-single-cut\ + + Release + true + true + true + + diff --git a/src/MBA.Cli/packages.lock.json b/src/MBA.Cli/packages.lock.json new file mode 100644 index 0000000..0fe33fb --- /dev/null +++ b/src/MBA.Cli/packages.lock.json @@ -0,0 +1,120 @@ +{ + "version": 2, + "dependencies": { + "net7.0": { + "Serilog": { + "type": "Direct", + "requested": "[3.0.1, )", + "resolved": "3.0.1", + "contentHash": "E4UmOQ++eNJax1laE+lws7E3zbhKgHsGJbO7ra0yE5smUh+5FfUPIKKBxM3MO1tK4sgpQke6/pLReDxIc/ggNw==" + }, + "Serilog.Sinks.Console": { + "type": "Direct", + "requested": "[4.1.0, )", + "resolved": "4.1.0", + "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.Debug": { + "type": "Direct", + "requested": "[2.0.0, )", + "resolved": "2.0.0", + "contentHash": "Y6g3OBJ4JzTyyw16fDqtFcQ41qQAydnEvEqmXjhwhgjsnG/FaJ8GUqF5ldsC/bVkK8KYmqrPhDO+tm4dF6xx4A==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.File": { + "type": "Direct", + "requested": "[5.0.0, )", + "resolved": "5.0.0", + "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "mba.core": { + "type": "Project", + "dependencies": { + "Maa.AgentBinary": "[1.0.0, )", + "Maa.ToolKit.Extensions": "[0.3.7.2, )", + "Serilog": "[3.0.1, )", + "Serilog.Sinks.Console": "[4.1.0, )", + "Serilog.Sinks.Debug": "[2.0.0, )", + "Serilog.Sinks.File": "[5.0.0, )" + } + }, + "Maa.AgentBinary": { + "type": "CentralTransitive", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "09TsLd4LbaxoK68AZAg4MZFle/kkX8JZTbjRbkJYptyUCPCtdbVr8odukKG1CUzL4Wumbu+Fk7ppNX/OSlRMOA==" + }, + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + }, + "Maa.ToolKit.Extensions": { + "type": "CentralTransitive", + "requested": "[0.3.7.2, )", + "resolved": "0.3.7.2", + "contentHash": "3PDml4lHI6asYqom/Eq82UEndiT/uSiebpnE+qJv70Fyixt3rR8okqsh6uqEGZD/2UanYE3RlmofZmqdJZdR4Q==", + "dependencies": { + "Maa.Framework.Runtimes": "0.3.7" + } + } + }, + "net7.0/linux-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/linux-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/osx-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/osx-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/win-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/win-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + } + } +} \ No newline at end of file diff --git a/src/MBA.Core/packages.lock.json b/src/MBA.Core/packages.lock.json new file mode 100644 index 0000000..de99412 --- /dev/null +++ b/src/MBA.Core/packages.lock.json @@ -0,0 +1,109 @@ +{ + "version": 2, + "dependencies": { + "net7.0": { + "Maa.AgentBinary": { + "type": "Direct", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "09TsLd4LbaxoK68AZAg4MZFle/kkX8JZTbjRbkJYptyUCPCtdbVr8odukKG1CUzL4Wumbu+Fk7ppNX/OSlRMOA==" + }, + "Maa.ToolKit.Extensions": { + "type": "Direct", + "requested": "[0.3.7.2, )", + "resolved": "0.3.7.2", + "contentHash": "3PDml4lHI6asYqom/Eq82UEndiT/uSiebpnE+qJv70Fyixt3rR8okqsh6uqEGZD/2UanYE3RlmofZmqdJZdR4Q==", + "dependencies": { + "Maa.Framework.Runtimes": "0.3.7" + } + }, + "Serilog": { + "type": "Direct", + "requested": "[3.0.1, )", + "resolved": "3.0.1", + "contentHash": "E4UmOQ++eNJax1laE+lws7E3zbhKgHsGJbO7ra0yE5smUh+5FfUPIKKBxM3MO1tK4sgpQke6/pLReDxIc/ggNw==" + }, + "Serilog.Sinks.Console": { + "type": "Direct", + "requested": "[4.1.0, )", + "resolved": "4.1.0", + "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.Debug": { + "type": "Direct", + "requested": "[2.0.0, )", + "resolved": "2.0.0", + "contentHash": "Y6g3OBJ4JzTyyw16fDqtFcQ41qQAydnEvEqmXjhwhgjsnG/FaJ8GUqF5ldsC/bVkK8KYmqrPhDO+tm4dF6xx4A==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.File": { + "type": "Direct", + "requested": "[5.0.0, )", + "resolved": "5.0.0", + "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/linux-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/linux-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/osx-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/osx-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/win-arm64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + }, + "net7.0/win-x64": { + "Maa.Framework.Runtimes": { + "type": "CentralTransitive", + "requested": "[0.3.7, )", + "resolved": "0.3.7", + "contentHash": "GfcKrwhrJGDtgXdf/B6xQezkdAXKixck2B3XMnZynGjf9YB+Mpmji9457/zdJ9q910QqPD+TId8lNF0LkbY0/w==" + } + } + } +} \ No newline at end of file