68 lines
2.2 KiB
YAML
68 lines
2.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
|
|
jobs:
|
|
build:
|
|
uses: ./.github/workflows/build-ci.yml
|
|
|
|
release:
|
|
name: 打包 & 发布
|
|
needs: build
|
|
runs-on: windows-latest
|
|
if: ${{ github.event_name == 'push' }}
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 下载编译产物
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: wechatferry-binaries
|
|
path: tmp
|
|
|
|
- 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()
|
|
$version = $version_full -replace '(\d+\.\d+\.\d+)\.\d+', '$1'
|
|
echo "version=$version" >> $env:GITHUB_ENV
|
|
echo "wechat_version=$wechat_version" >> $env:GITHUB_ENV
|
|
echo "Program Version: $version"
|
|
echo "WeChat Version: $wechat_version"
|
|
|
|
- name: 打包输出文件及下载 WeChat 安装包
|
|
shell: pwsh
|
|
run: |
|
|
Compress-Archive `
|
|
-Path "tmp/*" `
|
|
-DestinationPath "tmp/v${{ env.version }}.zip"
|
|
|
|
Remove-Item -Path "tmp/*.dll", "tmp/*.md"
|
|
|
|
# 下载对应版本微信安装包
|
|
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: 发布到 GitHub Releases
|
|
uses: ncipollo/release-action@main
|
|
with:
|
|
name: v${{ env.version }}
|
|
tag: v${{ env.version }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
allowUpdates: true
|
|
artifacts: "tmp/*"
|
|
body: |
|
|
程序版本:`v${{ env.version }}`
|
|
配套微信版本:`${{ env.wechat_version }}`
|
|
[📖 Python 文档](https://wechatferry.readthedocs.io/)
|