diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f8c92c..b138aeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,13 +17,13 @@ jobs: name: 打包 & 发布 needs: build runs-on: windows-latest - # 仅当触发源是 push 且是 Tag 时才执行 if: ${{ github.event_name == 'push' }} steps: - name: 检出代码 uses: actions/checkout@v4 - name: 获取版本号和微信版本号 + shell: pwsh run: | $version_full = (Select-String -Path "WeChatFerry/spy/spy.rc" -Pattern 'VALUE "FileVersion", "(.*)"').Matches.Groups[1].Value.Trim() $wechat_version = (Select-String -Path "WeChatFerry/spy/spy.rc" -Pattern 'VALUE "ProductVersion", "(.*)"').Matches.Groups[1].Value.Trim() @@ -32,19 +32,26 @@ jobs: echo "wechat_version=$wechat_version" >> $env:GITHUB_ENV echo "Program Version: $version" echo "WeChat Version: $wechat_version" - shell: pwsh - name: 打包输出文件及下载 WeChat 安装包 - run: | - New-Item -ItemType Directory -Force -Path "tmp" - Compress-Archive -Path "Out/sdk.dll", "Out/spy.dll", "Out/spy_debug.dll", "Out/DISCLAIMER.md" -DestinationPath "tmp/v${{ env.version }}.zip" - Invoke-WebRequest -Uri "https://github.com/tom-snow/wechat-windows-versions/releases/download/v${{ env.wechat_version }}/WeChatSetup-${{ env.wechat_version }}.exe" -OutFile "tmp/WeChatSetup-${{ env.wechat_version }}.exe" shell: pwsh + run: | + # 在根目录创建 tmp + New-Item -ItemType Directory -Force -Path tmp + + # 压缩根目录下 Out 中的产物 + Compress-Archive ` + -Path "WeChatFerry/Out/sdk.dll","WeChatFerry/Out/spy.dll","WeChatFerry/Out/spy_debug.dll","WeChatFerry/Out/DISCLAIMER.md" ` + -DestinationPath "tmp/v${{ env.version }}.zip" + + # 下载对应 WeChat 安装包 + Invoke-WebRequest ` + -Uri "https://github.com/tom-snow/wechat-windows-versions/releases/download/v${{ env.wechat_version }}/WeChatSetup-${{ env.wechat_version }}.exe" ` + -OutFile "tmp/WeChatSetup-${{ env.wechat_version }}.exe" - name: 列出待发布文件 - run: | - Get-ChildItem -Path "tmp" -Recurse shell: pwsh + run: Get-ChildItem -Path tmp -Recurse - name: 发布到 GitHub Releases uses: ncipollo/release-action@main