Skip to content

feat: JudgeDisplayPro #805

feat: JudgeDisplayPro

feat: JudgeDisplayPro #805

Workflow file for this run

name: AquaMai Build
on:
workflow_dispatch:
push:
pull_request_target:
permissions:
contents: read
jobs:
build-dependencies:
runs-on: windows-latest
steps:
- name: Checkout build dependencies
uses: clansty/checkout@main
with:
repository: MuNET-OSS/AquaMai-Build-Assets
ssh-key: ${{ secrets.BUILD_ASSETS_KEY }}
path: build-assets
max-attempts: 50
min-retry-interval: 1
max-retry-interval: 5
- name: Stage build dependencies
shell: pwsh
run: |
New-Item -ItemType Directory -Path "build-dependencies/SDEZ" -Force | Out-Null
Copy-Item -Path "build-assets/SDEZ/AMDaemon.NET.dll" -Destination "build-dependencies/SDEZ/AMDaemon.NET.dll" -Force
Copy-Item -Path "build-assets/SDEZ/Assembly-CSharp.dll" -Destination "build-dependencies/SDEZ/Assembly-CSharp.dll" -Force
- name: Save build dependencies cache
uses: actions/cache/save@v4
with:
key: AquaMai-build-dependencies-${{ github.run_id }}
path: build-dependencies/SDEZ
build:
needs: build-dependencies
runs-on: windows-latest
outputs:
git_describe: ${{ steps.git-describe.outputs.git_describe }}
steps:
- name: Fix Git line encoding bug
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout pull request source
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
path: source
persist-credentials: false
- name: Checkout source
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
path: source
persist-credentials: false
- name: Checkout trusted scripts
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.pull_request.base.sha }}
path: trusted-source
persist-credentials: false
- name: Get Git Describe
id: git-describe
shell: pwsh
working-directory: source
run: |
$raw = git describe --tags --always
if ($raw.StartsWith("v")) { $raw = $raw.Substring(1) }
$parts = $raw.Split('-')
if ($parts.Length -ge 3) {
$ver = $parts[0].Split('.')
$ver[2] = $parts[1]
$raw = ($ver -join '.') + '-' + $parts[2]
}
"GIT_DESCRIBE=$raw" >> $env:GITHUB_ENV
"git_describe=$raw" >> $env:GITHUB_OUTPUT
- name: Restore build dependencies cache
uses: actions/cache/restore@v4
with:
key: AquaMai-build-dependencies-${{ github.run_id }}
path: build-dependencies/SDEZ
fail-on-cache-miss: true
- name: Build AquaMai
shell: pwsh
working-directory: source
run: |
New-Item -ItemType Directory -Path "Libs" -Force | Out-Null
Copy-Item -Path "../build-dependencies/SDEZ/*" -Destination "Libs" -Force
if ("${{ github.event_name }}" -eq "pull_request_target") {
& ../trusted-source/build.ps1 -SourceRoot .
} else {
& ./build.ps1
}
- name: Prepare artifact
shell: pwsh
working-directory: source
run: |
New-Item -ItemType Directory -Path "Output/Upload" -Force | Out-Null
Move-Item -Path "Output/AquaMai.dll" -Destination "Output/Upload/AquaMai.dll" -Force
Move-Item -Path "Output/AquaMai.zh.toml" -Destination "Output/Upload/AquaMai.zh.toml" -Force
Move-Item -Path "Output/AquaMai.en.toml" -Destination "Output/Upload/AquaMai.en.toml" -Force
- name: Upload unsigned artifact
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: AquaMai-unsigned
path: source/Output/Upload
- name: Upload artifact
if: github.event_name == 'pull_request_target' || github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: AquaMai
path: source/Output/Upload
release:
needs: build
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
runs-on: windows-latest
steps:
- name: Download unsigned artifact
uses: actions/download-artifact@v4
with:
name: AquaMai-unsigned
path: Output/Upload
- name: Checkout release assets
uses: clansty/checkout@main
with:
repository: MuNET-OSS/AquaMai-Build-Assets
ssh-key: ${{ secrets.BUILD_ASSETS_KEY }}
path: release-assets
max-attempts: 50
min-retry-interval: 1
max-retry-interval: 5
- name: Sign and Upload CI release
shell: cmd
run: release-assets\Releaser\AquaMaiReleaser.exe "Output\Upload\AquaMai.dll" "${{ needs.build.outputs.git_describe }}"
env:
LEGACY_RELEASE_SIGN_PK: ${{ secrets.LEGACY_RELEASE_SIGN_PK }}
RELEASE_SIGN_V2_PK: ${{ secrets.RELEASE_SIGN_V2_PK }}
QCLOUD_SECRET_ID: ${{ secrets.QCLOUD_SECRET_ID }}
QCLOUD_SECRET_KEY: ${{ secrets.QCLOUD_SECRET_KEY }}
R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }}
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
VERSION_CONFIG_TOKEN: ${{ secrets.VERSION_CONFIG_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: AquaMai
path: Output/Upload
- name: Send to Telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
GIT_DESCRIBE: ${{ needs.build.outputs.git_describe }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message || '' }}
run: |
$Uri = "https://api.telegram.org/bot$env:TELEGRAM_BOT_TOKEN/sendMediaGroup"
$GitDescribe = $env:GIT_DESCRIBE
$CommitMessage = $env:COMMIT_MESSAGE
$Form = @{
chat_id = "-1002231087502"
media = @(
@{ type = "document"; media = "attach://aquamai_main"; caption = "$GitDescribe`n$CommitMessage" },
@{ type = "document"; media = "attach://aquamai_zh" }
@{ type = "document"; media = "attach://aquamai_en" }
) | ConvertTo-Json
aquamai_main = Get-Item Output\Upload\AquaMai.dll
aquamai_zh = Get-Item Output\Upload\AquaMai.zh.toml
aquamai_en = Get-Item Output\Upload\AquaMai.en.toml
}
Invoke-RestMethod -Uri $uri -Form $Form -Method Post