diff --git a/.gitignore b/.gitignore index b35cd90..9ef6daa 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ /venv /release /.idea +/venv.* /bookmark.html /bookmark.json \ No newline at end of file diff --git a/README.MD b/README.MD index 5346ce6..218ea1a 100644 --- a/README.MD +++ b/README.MD @@ -33,15 +33,27 @@ ### Using the executable file (no Python environment required) -1. Go to [Releases](https://github.com/Physton/arc-bookmarks/releases) and download [arc-bookmarks](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks). -2. Open the system `Terminal` application. -3. Add executable permission to the `arc-bookmarks` file. +> For versions prior to v0.0.4, please refer to this document: [README](https://github.com/Physton/arc-bookmarks/tree/6ea6b782665f7c790511c3c0a3034809bd504d89#usage) + +1. Go to [Releases](https://github.com/Physton/arc-bookmarks/releases) and download according to your system version. + - [M1/M../arm64 (Apple Silicon)](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks.macos.arm64.zip) + - [x86_64 (Intel)](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks.macos.x86_64.zip) +2. Unzip the `arc-bookmarks.macos.*.zip` file. +3. Open the `Terminal` application on your system. +4. Navigate to the `arc-bookmarks.macos.*` folder. ```bash - chmod +x ~/Downloads/arc-bookmarks + # Apple Silicon + cd ~/Downloads/arc-bookmarks.macos.arm64 + # Intel + cd ~/Downloads/arc-bookmarks.macos.x86_64 ``` -4. Execute the `arc-bookmarks` file. +5. Add execution permissions to the `arc-bookmarks` file. ```bash - ~/Downloads/arc-bookmarks --save-html=~/Downloads/bookmark.html + chmod +x ./arc-bookmarks + ``` +6. Run the `arc-bookmarks` file. + ```bash + ./arc-bookmarks --save-html=~/Downloads/bookmark.html ``` ### Using Python to run diff --git a/README_CN.MD b/README_CN.MD index 70a0e2b..5726d1b 100644 --- a/README_CN.MD +++ b/README_CN.MD @@ -33,15 +33,27 @@ ### 使用可执行文件(无需 python 环境) -1. 前往 [Releases](https://github.com/Physton/arc-bookmarks/releases),下载 [arc-bookmarks](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks) 。 -2. 打开系统 `终端` 应用程序。 -3. 为 `arc-bookmarks` 文件添加可执行权限。 +> v0.0.4 之前的版本,请查看此文档:[README](https://github.com/Physton/arc-bookmarks/blob/6ea6b782665f7c790511c3c0a3034809bd504d89/README_CN.MD#%E4%BD%BF%E7%94%A8) + +1. 前往 [Releases](https://github.com/Physton/arc-bookmarks/releases),根据自己的系统版本下载。 + - [M1/M../arm64 (Apple Silicon)](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks.macos.arm64.zip) + - [x86_64 (Intel)](https://github.com/Physton/arc-bookmarks/releases/latest/download/arc-bookmarks.macos.x86_64.zip) +2. 解压缩 `arc-bookmarks.macos.*.zip` 文件。 +3. 打开系统 `终端` 应用程序。 +4. 进入 `arc-bookmarks.macos.*` 文件夹。 ```bash - chmod +x ~/Downloads/arc-bookmarks + # Apple Silicon + cd ~/Downloads/arc-bookmarks.macos.arm64 + # Intel + cd ~/Downloads/arc-bookmarks.macos.x86_64 ``` -4. 执行 `arc-bookmarks` 文件。 +5. 为 `arc-bookmarks` 文件添加可执行权限。 ```bash - ~/Downloads/arc-bookmarks --save-html=~/Downloads/bookmark.html + chmod +x ./arc-bookmarks + ``` +6. 执行 `arc-bookmarks` 文件。 + ```bash + ./arc-bookmarks --save-html=~/Downloads/bookmark.html ``` ### 使用 python 运行 diff --git a/build.sh b/build.sh index 7a134c7..c6b130a 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,56 @@ #!/bin/bash -./venv/bin/pyinstaller main.py -F -n arc-bookmarks -chmod +x dist/arc-bookmarks \ No newline at end of file + +set -e + +echo_success() { + echo -e "\033[32m$1\033[0m" +} + +echo_error() { + echo -e "\033[31m$1\033[0m" +} + +build() { + platform=$1 + echo_success "========= Building for $platform =========" + + if [ "$platform" = "x86_64" ]; then + arch_prefix="arch -x86_64" + brew_prefix="/usr/local" + elif [ "$platform" = "arm64" ]; then + arch_prefix="arch -arm64" + brew_prefix="/opt/homebrew" + else + echo_error "Invalid platform" + exit 1 + fi + + eval "$($arch_prefix $brew_prefix/bin/brew shellenv)" + + if [ ! -d ./venv.$platform ]; then + echo_success "Creating venv.$platform" + ${brew_prefix}/bin/python3 -m venv ./venv.$platform + fi + + # echo "Activating venv.$platform" + # source ./venv.$platform/bin/activate + + echo_success "Installing requirements" + $arch_prefix ./venv.$platform/bin/pip3 install -r requirements.txt + + echo_success "Building arc-bookmarks" + build_name="arc-bookmarks.macos.$platform" + $arch_prefix ./venv.$platform/bin/cxfreeze -c main.py --target-name=arc-bookmarks --target-dir=build/$build_name + chmod +x build/$build_name/arc-bookmarks + cd build + zip -r $build_name.zip $build_name -9 + rm -rf $build_name + cd .. + + echo_success "Build successful" +} + +rm -rf build + +build x86_64 +build arm64 \ No newline at end of file diff --git a/main.py b/main.py index a1c9b46..8de2e7e 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ import time import requests -VERSION = 'v0.0.3' +VERSION = 'v0.0.4' REPO = 'Physton/arc-bookmarks' GITHUB = f'https://github.com/{REPO}' diff --git a/release.py b/release.py index a6dae87..8ceca20 100755 --- a/release.py +++ b/release.py @@ -57,8 +57,13 @@ release = repo.create_git_release(tag_name, release_title, release_body) # 上传文件到发布 - file_name = 'arc-bookmarks' - file_path = os.path.join(main_path, 'dist', file_name) + file_name = 'arc-bookmarks.macos.arm64.zip' + file_path = os.path.join(main_path, 'build', file_name) + file_path = os.path.abspath(file_path) + release.upload_asset(file_path, content_type='application/octet-stream', label=file_name) + + file_name = 'arc-bookmarks.macos.x86_64.zip' + file_path = os.path.join(main_path, 'build', file_name) file_path = os.path.abspath(file_path) release.upload_asset(file_path, content_type='application/octet-stream', label=file_name) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8b0ffc5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests +cx_Freeze \ No newline at end of file