Skip to content

Commit

Permalink
[CI] 加入预设签名
Browse files Browse the repository at this point in the history
  • Loading branch information
fy0 committed Apr 1, 2024
1 parent c30f5bb commit 658f7c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/Lagrange.OneBot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set secret
env:
MY_ENV_VAR: ${{ secrets.KEY }}
run: |
sed -i 's/\$(SIGN_SERVER_DEFAULT)/'"${MY_ENV_VAR}"'/g' 'Lagrange.OneBot/Utility/OneBotSigner.cs'
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/Lagrange.OneBot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Set secret
env:
MY_ENV_VAR: ${{ secrets.KEY }}
run: |
$envValue = $env:MY_ENV_VAR
$content = Get-Content -Path 'Lagrange.OneBot\Utility\OneBotSigner.cs' -Raw
$content = $content.Replace('$(SIGN_SERVER_DEFAULT)', $envValue)
$content | Set-Content -Path 'Lagrange.OneBot\Utility\OneBotSigner.cs'
- name: Build Lagrange.OneBot .NET 8.0
shell: powershell
run: |
Expand Down
7 changes: 6 additions & 1 deletion Lagrange.OneBot/Utility/OneBotSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ public class OneBotSigner : SignProvider

public OneBotSigner(IConfiguration config, ILogger<OneBotSigner> logger)
{
_signServer = config["SignServerUrl"] ?? "";
var _signServerUrl = config["SignServerUrl"] ?? "";
if (_signServerUrl == "https://lwxmagic.sealdice.com/api/sign") {
_signServerUrl = "$(SIGN_SERVER_DEFAULT)";
}

_signServer = _signServerUrl;
_logger = logger;
_client = new HttpClient();

Expand Down

0 comments on commit 658f7c4

Please sign in to comment.