68 lines
2.2 KiB
YAML
68 lines
2.2 KiB
YAML
name: Publish
|
||
|
||
on:
|
||
# 当master分支有push时,触发action
|
||
push:
|
||
tags:
|
||
- 'v*' # 以 'v' 开头的标签触发工作流程
|
||
|
||
jobs:
|
||
publish:
|
||
name: Publish Pypi and Create Release
|
||
if: github.repository == 'xaoyaoo/PyWxDump' # 仅在指定仓库的 tag 触发工作流程
|
||
# 此作业在 Linux 上运行
|
||
runs-on: windows-latest
|
||
|
||
steps:
|
||
- name: Checkout repository # 检出仓库
|
||
uses: actions/checkout@v2 # 使用 GitHub 官方的 checkout action
|
||
- run: |
|
||
git fetch --prune --unshallow
|
||
|
||
- name: Set up Python # 设置 Python 环境
|
||
uses: actions/setup-python@v2 # 使用 GitHub 官方的 setup-python action
|
||
with:
|
||
python-version: 3.8 # 指定 Python 版本 (3.8)
|
||
|
||
- name: Install dependencies # 安装依赖
|
||
run: |
|
||
python -m pip install --upgrade pip
|
||
pip install build
|
||
python -m pip install --upgrade twine
|
||
pip install pyinstaller
|
||
|
||
- name: Build package
|
||
run: |
|
||
python -m build
|
||
python tests/build_exe.py
|
||
|
||
- name: Build Executable
|
||
run: |
|
||
pyinstaller --onefile --clean --add-data "${{ github.workspace }}/version_list.json;pywxdump" --add-data "${{ github.workspace }}/show_chat/templates/chat.html;pywxdump/show_chat/templates" --add-data "${{ github.workspace }}/show_chat/templates/index.html;pywxdump/show_chat/templates" --distpath=dist --workpath=build --specpath=build --name=pywxdump ${{ github.workspace }}/dist/tmp.py
|
||
|
||
- name: test
|
||
run: |
|
||
ls -l dist
|
||
|
||
- name: Publish package with Twine # 使用 Twine 发布到 PyPI
|
||
run: |
|
||
twine upload dist/*.whl dist/*.tar.gz
|
||
env:
|
||
TWINE_USERNAME: __token__
|
||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
||
|
||
- name: Create Release
|
||
id: create_release
|
||
uses: softprops/action-gh-release@v1
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
with:
|
||
tag_name: ${{ github.ref }}
|
||
release_name: Release ${{ github.ref }}
|
||
body: |
|
||
[Auto Release] Update PyWxDump
|
||
draft: false
|
||
prerelease: false
|
||
files: |
|
||
dist/*.exe
|
||
dist/*.whl |