-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (64 loc) · 2.62 KB
/
main.yml
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
75
76
77
78
name: Auto Build DEV
on:
push:
branches:
- main
jobs:
build:
runs-on: windows-latest
environment: KeywordGacha
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Update Python
run: python -m pip install --upgrade pip
- name: Install Requirements
run: pip install -r requirements.txt
- name: Build EXE
run: pyinstaller --name KeywordGacha --clean --noconfirm main.py
- name: Compress Archive
id: compress_files
shell: pwsh
run: |
# 获取当前UTC时间
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
# 调整为东八区时间(北京时间)
$timestamp = ([System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([datetime]::ParseExact($timestamp, "yyyyMMdd_HHmmss", $null), [System.TimeZoneInfo]::Utc.Id, 'China Standard Time')).ToString("yyyyMMdd_HHmmss")
# 复制文件到dist目录
Copy-Item -Path "prompt" -Destination "dist\KeywordGacha" -Recurse -Force
Copy-Item -Path "config.json" -Destination "dist\KeywordGacha" -Force
Copy-Item -Path "blacklist.txt" -Destination "dist\KeywordGacha" -Force
# 压缩dist目录下的所有文件,不包括dist目录本身
Compress-Archive -Path "dist\*" -DestinationPath "KeywordGacha_DEV_$timestamp.zip" -Force
# 输出 timestamp 变量以供后续步骤使用
echo "::set-output name=timestamp::$timestamp"
- name: Delete Previous Release
uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
tag_name: DEV_BUILD
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.KEYWORDGACHA_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.KEYWORDGACHA_TOKEN }}
with:
tag_name: DEV_BUILD
release_name: KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}
draft: false
prerelease: false
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.KEYWORDGACHA_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}.zip
asset_name: KeywordGacha_DEV_${{ steps.compress_files.outputs.timestamp }}.zip
asset_content_type: application/octet-stream