Skip to content

docs: README/AGENTS cleanup -- remove emoji, update descriptions, addโ€ฆ #13

docs: README/AGENTS cleanup -- remove emoji, update descriptions, addโ€ฆ

docs: README/AGENTS cleanup -- remove emoji, update descriptions, addโ€ฆ #13

Workflow file for this run

name: Build and Release
# ่งฆๅ‘ๆกไปถ๏ผšpush main๏ผ›BsKeyTools ็‰ˆๆœฌๆœชๅ˜ๅˆ™่‡ชๅŠจ่ทณ่ฟ‡
on:
push:
branches: [main]
permissions:
contents: write
jobs:
# โ”€โ”€ Job 0: ๆฃ€ๆต‹ BsKeyTools ็‰ˆๆœฌๆ˜ฏๅฆ้œ€่ฆๅ‘ๅธƒ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
check-version:
runs-on: ubuntu-latest
outputs:
bskt_version: ${{ steps.ver.outputs.BSKT_VERSION }}
bscv_version: ${{ steps.ver.outputs.BSCV_VERSION }}
tag: ${{ steps.ver.outputs.TAG }}
should_release: ${{ steps.ver.outputs.SHOULD_RELEASE }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect versions and check tag
id: ver
run: |
# BsKeyTools ็‰ˆๆœฌ๏ผˆBulletKeyTools.ms๏ผ‰
BSKT=$(python3 -c "
import re, sys
with open('_BsKeyTools/Scripts/BulletScripts/BulletKeyTools.ms', encoding='utf-8', errors='replace') as f:
c = f.read()
m = re.search(r'global\s+curVerBsKeyTools\s*=\s*\"([^\"]+)\"', c)
if not m: sys.exit('curVerBsKeyTools not found in BulletKeyTools.ms')
print(m.group(1))
")
# BsCleanVirus ็‰ˆๆœฌ๏ผˆBsCleanVirus.ms๏ผ‰
BSCV=$(python3 -c "
import re, sys
with open('_BsKeyTools/Scripts/BulletScripts/BsCleanVirus.ms', encoding='utf-8', errors='replace') as f:
c = f.read()
m = re.search(r'global\s+curVerBsCleanVirus\s*=\s*\"([^\"]+)\"', c)
if not m: sys.exit('curVerBsCleanVirus not found in BsCleanVirus.ms')
print(m.group(1))
")
TAG="v$BSKT"
echo "BSKT_VERSION=$BSKT" >> $GITHUB_OUTPUT
echo "BSCV_VERSION=$BSCV" >> $GITHUB_OUTPUT
echo "TAG=$TAG" >> $GITHUB_OUTPUT
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "SHOULD_RELEASE=false" >> $GITHUB_OUTPUT
echo "Tag $TAG already exists, skipping release"
else
echo "SHOULD_RELEASE=true" >> $GITHUB_OUTPUT
echo "New version $TAG (BsKeyTools $BSKT / BsCleanVirus $BSCV)"
fi
# โ”€โ”€ Job 1: ๆž„ๅปบ BsKeyTools ๅฎ‰่ฃ…ๅŒ… โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
build-bskeytools:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Update NSIS versions
shell: pwsh
env:
RELEASE_VERSION: ${{ needs.check-version.outputs.bskt_version }}
PYTHONIOENCODING: utf-8
run: python scripts/update_manifest.py
- name: Install NSIS
shell: pwsh
run: |
choco install nsis --no-progress -y
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build BsKeyTools installer
shell: pwsh
working-directory: _BsKeyTools
run: makensis Setup_BsKeyTools.nsi
- name: Rename BsKeyTools installer
shell: pwsh
run: |
$v = "${{ needs.check-version.outputs.bskt_version }}"
Move-Item "_BsKeyTools\_BsKeyTools.exe" "_BsKeyTools\BsKeyTools_v$v.exe"
- name: Upload BsKeyTools artifact
uses: actions/upload-artifact@v4
with:
name: bskeytools-installer
path: "_BsKeyTools/BsKeyTools_v${{ needs.check-version.outputs.bskt_version }}.exe"
retention-days: 1
# โ”€โ”€ Job 2: ๆž„ๅปบ BsCleanVirus ๅฎ‰่ฃ…ๅŒ… โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
build-bscleanvirus:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Update NSIS versions
shell: pwsh
env:
RELEASE_VERSION: ${{ needs.check-version.outputs.bskt_version }}
PYTHONIOENCODING: utf-8
run: python scripts/update_manifest.py
- name: Install NSIS
shell: pwsh
run: |
choco install nsis --no-progress -y
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build BsCleanVirus installer
shell: pwsh
working-directory: _BsKeyTools
run: makensis Setup_BsCleanVirus.nsi
- name: Rename BsCleanVirus installer
shell: pwsh
run: |
$v = "${{ needs.check-version.outputs.bscv_version }}"
Move-Item "_BsKeyTools\BsCleanVirus_Standalone.exe" "_BsKeyTools\BsCleanVirus_v$v.exe"
- name: Upload BsCleanVirus artifact
uses: actions/upload-artifact@v4
with:
name: bscleanvirus-installer
path: "_BsKeyTools/BsCleanVirus_v${{ needs.check-version.outputs.bscv_version }}.exe"
retention-days: 1
# โ”€โ”€ Job 3: ๅ‘ๅธƒๅˆฐ GitHub๏ผŒๆ›ดๆ–ฐ version.dat โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
release:
needs: [check-version, build-bskeytools, build-bscleanvirus]
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BSKT="${{ needs.check-version.outputs.bskt_version }}"
BSCV="${{ needs.check-version.outputs.bscv_version }}"
TAG="${{ needs.check-version.outputs.tag }}"
gh release create "$TAG" \
--target main \
--title "BsKeyTools v$BSKT" \
--notes "BsKeyTools v$BSKT | BsCleanVirus v$BSCV" \
"dist/BsKeyTools_v$BSKT.exe" \
"dist/BsCleanVirus_v$BSCV.exe"
- name: Update version.dat and commit to main
env:
PYTHONIOENCODING: utf-8
run: |
python3 scripts/update_manifest.py
git add _BsKeyTools/version.dat _BsKeyTools/Setup_BsKeyTools.nsi _BsKeyTools/Setup_BsCleanVirus.nsi
if ! git diff --staged --quiet; then
BSKT="${{ needs.check-version.outputs.bskt_version }}"
git commit -m "chore: update version files โ†’ BsKeyTools $BSKT [skip ci]"
git push origin HEAD:main
fi
- name: Trigger Gitee mirror pull
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
run: |
RESP=$(curl -s -w "\n%{http_code}" -X POST \
"https://gitee.com/api/v5/repos/acebullet/BsKeyTools/remote_mirror/pull?access_token=${GITEE_TOKEN}")
HTTP_CODE=$(echo "$RESP" | tail -1)
BODY=$(echo "$RESP" | head -n -1)
echo "Gitee mirror pull: HTTP $HTTP_CODE"
echo "$BODY"
if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then
echo "::error::Gitee mirror pull failed (HTTP $HTTP_CODE)"
exit 1
fi