Skip to content

Commit

Permalink
feat: support prebuilt for MacOS M1
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNitroG committed Sep 24, 2024
1 parent 5f2f28f commit f6485eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,30 @@ jobs:
run: echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT

build:
name: build
name: build - ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- windows
- macos
runs-on: ${{ matrix.os }}-latest
- macos-13
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
if: ${{ needs.prepare.outputs.CONTINUE == 'true' }}
steps:
- name: get OS lowercase
id: get_os
shell: bash
run: echo "OS_LOWER=$(echo $RUNNER_OS | awk '{print tolower($0)}')" >> $GITHUB_ENV
run: |
case "${{ matrix.os }}" in
"macos-13") echo "OS_NAME_FOR_RELEASE=macos" >> "$GITHUB_ENV" ;;
"macos-latest") echo "OS_NAME_FOR_RELEASE=macos-m1" >> "$GITHUB_ENV" ;;
"ubuntu-latest") echo "OS_NAME_FOR_RELEASE=linux" >> "$GITHUB_ENV" ;;
"windows-latest") echo "OS_NAME_FOR_RELEASE=windows" >> "$GITHUB_ENV" ;;
esac
- name: Checkout repo
uses: actions/checkout@main
Expand All @@ -90,21 +97,17 @@ jobs:
- name: Install dependacies
run: pip install -r requirements/requirements.txt && pip install pyinstaller

- name: Build for ${{ env.OS_LOWER }}
env:
OS_LOWER: ${{ env.OS_LOWER }}
run: pyinstaller --noconfirm --onefile --console --icon="assets/images/VNU_HCM_LOGO-256.ico" --name="VNULIB-Downloader-${{ env.OS_LOWER }}" --log-level="INFO" --add-data="src/:src/" --add-data="config-sample.yml:." --add-data="assets/images/error_page.jpg:assets/images/" --add-data="assets/utils/ascii_banner.txt:assets/utils/" --add-data="LICENSE:." --collect-data grapheme "main.py"
- name: Build for ${{ env.OS_NAME_FOR_RELEASE }}
run: pyinstaller --noconfirm --onefile --console --icon="assets/images/VNU_HCM_LOGO-256.ico" --name="VNULIB-Downloader-${{ env.OS_NAME_FOR_RELEASE }}" --log-level="INFO" --add-data="src/:src/" --add-data="config-sample.yml:." --add-data="assets/images/error_page.jpg:assets/images/" --add-data="assets/utils/ascii_banner.txt:assets/utils/" --add-data="LICENSE:." --collect-data grapheme "main.py"

- name: Change permissions
if: runner.os == 'Linux' || runner.os == 'macOS'
run: chmod +x dist/VNULIB-Downloader-*

- name: Upload to artifact
env:
OS_LOWER: ${{ env.OS_LOWER }}
uses: actions/upload-artifact@main
with:
name: VNULIB-Downloader-${{ env.OS_LOWER }}
name: VNULIB-Downloader-${{ env.OS_NAME_FOR_RELEASE }}
path: dist/VNULIB-Downloader-*
compression-level: 6
retention-days: 30
Expand Down
5 changes: 3 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ Python CLI tool download sách từ <strong>VNULIB</strong>

- [![Windows](https://img.shields.io/badge/Windows-8aadf4?style=for-the-badge&logo=windows&logoColor=white)](https://github.com/KevinNitroG/VNULIB-Downloader/releases/latest/download/VNULIB-Downloader-windows.exe)
- [![Mac OS](https://img.shields.io/badge/MAC_OS-ed8796?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/KevinNitroG/VNULIB-Downloader/releases/latest/download/VNULIB-Downloader-macos)
- [![Mac OS M1](https://img.shields.io/badge/MAC_OS_M1-f38ba8?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/KevinNitroG/VNULIB-Downloader/releases/latest/download/VNULIB-Downloader-macos-m1)
- [![Linux](https://img.shields.io/badge/Linux-5b6078?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/KevinNitroG/VNULIB-Downloader/releases/latest/download/VNULIB-Downloader-linux)

> [!IMPORTANT]
>
> - Các bản prebuilt chỉ dành cho máy chip `AMD64`.
> - Với các máy dùng chip `ARM64` hãy dùng phương pháp [📦 Docker](#-docker) hoặc [🤐 Python](#-python).
> - Các bản prebuilt chỉ dành cho máy chip `AMD64` và MacOS chip `M1`.
> - Với các máy dùng chip `ARM64` khác hãy dùng phương pháp [📦 Docker](#-docker) hoặc [🤐 Python](#-python).
> - Các máy dùng chip khác có thể sẽ không dùng được vì một số thư viện không hỗ trợ. Hãy dùng tool đơn giản hơn như [`tlatonf/vnulib`](https://github.com/tlatonf/vnulib) _(Windows only)_.
> [!NOTE]
Expand Down
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _get_number_of_thread(max_number_of_threads: int) -> int:
return number_of_thread if number_of_thread * 5 < max_number_of_threads else max_number_of_threads


VERSION: str = "v1.17.5"
VERSION: str = "v1.17.6"
AUTHORS: str = "KevinNitroG & NTGNguyen"
BANNER_FILE: str = f"{BUNDLE_DIR}assets/utils/ascii_banner.txt"
with open(BANNER_FILE, encoding="utf-8") as banner_content:
Expand Down

0 comments on commit f6485eb

Please sign in to comment.