Skip to content

Commit

Permalink
feat: 打包方式修改
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumifa committed Sep 6, 2024
1 parent f797da0 commit d670363
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- os:
name: macos-14
filename: MacOS_amd64
end: ".dmg"
end: ""
- os:
name: macos-12
filename: MacOS_x64
end: ".dmg"
end: ""
- os:
name: windows-latest
filename: Windows
Expand Down Expand Up @@ -60,12 +60,6 @@ jobs:
# - name: Zip the Build-MacOS
# if: matrix.config.os.filename == 'MacOS_amd64' or matrix.config.os.filename == 'MacOS_x64'
# run: zip -r ${{ secrets.ReleaseZipName }}_${{ matrix.config.os.filename }}-${{github.ref_name}}.zip ./dist/biliTickerBuy.app/*
- name: dmg create
if: matrix.config.os.filename == 'MacOS_amd64' || matrix.config.os.filename == 'MacOS_x64'
uses: L-Super/create-dmg-actons@v1.0.3
with:
dmg_name: dist/biliTickerBuy
src_dir: dist/biliTickerBuy.app

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
Expand Down
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from config import get_application_path
from tab.go import go_tab
from tab.login import login_tab
from tab.problems import problems_tab
from tab.settings import setting_tab
from tab.train import train_tab
from tab.problems import problems_tab

header = """
# B 站会员购抢票🌈
Expand All @@ -36,8 +36,8 @@
parser.add_argument("--port", type=int, default=7860, help="server port")
parser.add_argument("--share", type=bool, default=False, help="create a public link")
args = parser.parse_args()

logger.add(os.path.join(get_application_path(), "app.log"))
log_file = os.path.join(get_application_path(), "app.log")
logger.add(log_file)
with gr.Blocks(head=short_js, css=custom_css) as demo:
gr.Markdown(header)
with gr.Tab("生成配置"):
Expand Down
33 changes: 1 addition & 32 deletions main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,4 @@ exe = EXE(
codesign_identity=None,
entitlements_file=None,
icon=['assets/icon.ico']
)


app = BUNDLE(exe,
name='biliTickerBuy.app',
icon='assets/icon.icns',
bundle_identifier=None
)
if platform.system() == "Darwin":
## Make app bundle double-clickable
import plistlib
from pathlib import Path
app_path = Path(app.name)

# read Info.plist
with open(app_path / 'Contents/Info.plist', 'rb') as f:
pl = plistlib.load(f)

# write Info.plist
with open(app_path / 'Contents/Info.plist', 'wb') as f:
pl['CFBundleExecutable'] = 'wrapper'
plistlib.dump(pl, f)

# write new wrapper script
shell_script = """#!/bin/bash
dir=$(dirname $0)
open -a Terminal file://${dir}/%s""" % app.appname
with open(app_path / 'Contents/MacOS/wrapper', 'w') as f:
f.write(shell_script)

# make it executable
(app_path / 'Contents/MacOS/wrapper').chmod(0o755)
)

0 comments on commit d670363

Please sign in to comment.