-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.5 KB
/
pdf-tools-app.yml
File metadata and controls
74 lines (65 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# This workflow will build the target file in a Windows environment by executing a specific script
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application - Windows Build
on:
workflow_dispatch:
inputs:
version:
description: '版本号'
required: true
default: 'v0.0.1.21'
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Set Environment Variables
run: |
echo "PYTHONIOENCODING=utf-8" >> $GITHUB_ENV
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
cd pdf_tools
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build target file
run: |
cd pdf_tools
python build_exe.py --version ${{ github.event.inputs.version }}
- name: Verify EXE file exists
shell: pwsh
run: |
Write-Host "Current directory contents:"
Get-ChildItem -Path .
Write-Host "`npdf_tools/dist/ directory contents:"
Get-ChildItem -Path "pdf_tools/dist/"
- name: Upload EXE as Artifact
uses: actions/upload-artifact@v4
with:
name: PDF工具_${{ github.event.inputs.version }}.exe
path: pdf_tools/dist/PDF工具_${{ github.event.inputs.version }}.exe # 修改为生成的 EXE 文件路径
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.event.inputs.version }} # 替换为实际的版本号
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Upload EXE to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pdf_tools/dist/PDF工具_${{ github.event.inputs.version }}.exe # 修改为生成的 EXE 文件路径
asset_name: PDF_Tools_${{ github.event.inputs.version }}.exe
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}