一些优化 #63
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: Auto Build Test | |
on: | |
push: | |
branches: [ "bepinex5" ] | |
pull_request: | |
merge_group: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
# Checkout the repository | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup .NET SDK | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
# Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore --locked-mode | |
# Build the project | |
- name: Build HsMod | |
run: dotnet build --configuration Release --no-restore | |
# Upload the built artifact | |
- name: Upload HsMod to artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HsMod.dll | |
path: HsMod/Release/HsMod.dll | |
compression-level: 9 | |
push_to_telegram: | |
runs-on: ubuntu-latest | |
name: Push to Telegram | |
needs: build | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Find Artifacts | |
run: | | |
echo "HSMOD_FILE=$(find artifacts -type f -name '*.dll' -print -quit)" | |
echo "HSMOD_FILE=$(find artifacts -type f -name '*.dll' -print -quit)" >> $GITHUB_ENV | |
- name: Post to Telegram | |
env: | |
CHAT_ID: ${{ secrets.CHAT_ID }} | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} | |
HSMOD_DLL: ${{ env.HSMOD_FILE }} | |
COMMIT_MESSAGE: |+ | |
New push to GitHub | |
``` | |
${{ github.event.head_commit.message }} | |
```by `${{ github.event.head_commit.author.name }}` | |
See commit detail [here](${{ github.event.head_commit.url }}) | |
run: | | |
ESCAPED=$(python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))') | |
cd ${{ github.workspace }} | |
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHAT_ID}&message_thread_id=${MESSAGE_THREAD_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://canary%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F canary="@${HSMOD_DLL}" |