From 3d45480fa0035dd8503f086d1c8d2c834765dcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Dec 2024 21:21:54 +0900 Subject: [PATCH 1/3] ci: use gitea actions for build and deployments --- .drone.yml | 35 ----------------------------------- .editorconfig | 2 +- .gitea/workflows/build.yaml | 35 +++++++++++++++++++++++++++++++++++ scripts/deploy.sh | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/build.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 02c6988..0000000 --- a/.drone.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -kind: pipeline -type: docker -name: default - -steps: - - name: test & build - image: node:22.12.0-bookworm - commands: - # - git config --global --add safe.directory "/drone/src" - - corepack enable - - corepack prepare pnpm@latest --activate - - pnpm i --frozen-lockfile - - pnpm build - environment: - # 让 npm 使用淘宝源 - npm_config_registry: https://registry.npmmirror.com - - - name: publish - image: node:22.12.0-bookworm - environment: - DRONE_GITEA_SERVER: https://git.unlock-music.dev - GITEA_API_KEY: - from_secret: GITEA_API_KEY - NETLIFY_SITE_ID: - from_secret: NETLIFY_SITE_ID - NETLIFY_API_KEY: - from_secret: NETLIFY_API_KEY - commands: - - | - python3 -m zipfile -c um-react.zip dist/. - cp um-react.zip dist/"release-${DRONE_COMMIT_SHA}.zip" - python3 -m zipfile -c um-react-site.zip dist/. - - ./scripts/publish.sh - - ./scripts/deploy.sh diff --git a/.editorconfig b/.editorconfig index 43a0ceb..a9bfe09 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,5 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.{{c,m,}js{x,on,},ts{x,}}] +[*.{{c,m,}js{x,on,},ts{x,},y{,a}ml}] indent_size = 2 diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..0e67d06 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,35 @@ +name: Build and Deploy +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + env: + npm_config_registry: https://registry.npmmirror.com + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v4.0.0 + with: + standalone: true + run_install: | + - args: [--frozen-lockfile, --strict-peer-dependencies] + - name: Build + run: pnpm build + - name: Prepare for deployment + run: | + python3 -m zipfile -c um-react.zip dist/. + cp um-react.zip dist/"release-${GITHUB_SHA}.zip" + python3 -m zipfile -c um-react-site.zip dist/. + - name: Publish Artifact + uses: actions/upload-artifact@v4 + with: + name: site + path: dist/ + - name: Deploy + env: + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + NETLIFY_API_KEY: ${{ secrets.NETLIFY_API_KEY }} + run: | + ./scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh index c7fa577..786cc64 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -103,7 +103,7 @@ deploy_netlify() { # For deployment, we care a bit less if [[ -n "${NETLIFY_API_KEY}" && -n "${NETLIFY_SITE_ID}" ]]; then - echo "Deploy to netlify..." + echo "Deploy to netlify (branch: ${BRANCH_NAME})..." deploy_netlify um-react-site.zip else echo "skip netlify deployment." -- 2.45.2 From de6fc4c2c072e66e123ea19ef3884c9e0529482a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Dec 2024 21:30:12 +0900 Subject: [PATCH 2/3] ci: workaround artifact bug see: https://github.com/go-gitea/gitea/pull/28965 --- .gitea/workflows/build.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 0e67d06..a3333fa 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: cp um-react.zip dist/"release-${GITHUB_SHA}.zip" python3 -m zipfile -c um-react-site.zip dist/. - name: Publish Artifact - uses: actions/upload-artifact@v4 + uses: christopherhx/gitea-upload-artifact@v4 with: name: site path: dist/ @@ -31,5 +31,4 @@ jobs: env: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} NETLIFY_API_KEY: ${{ secrets.NETLIFY_API_KEY }} - run: | - ./scripts/deploy.sh + run: ./scripts/deploy.sh -- 2.45.2 From 600c10299e6f4d2c36aa30bce2258c4d5fc8b5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Dec 2024 21:34:53 +0900 Subject: [PATCH 3/3] docs: update link to artifacts, cleanup npmrc --- .npmrc | 1 - README.MD | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.npmrc b/.npmrc index 22bc6e4..a9c26b3 100644 --- a/.npmrc +++ b/.npmrc @@ -1,4 +1,3 @@ use-node-version=22.12.0 engine-strict=true -@um:registry=https://git.unlock-music.dev/api/packages/um/npm/ @unlock-music:registry=https://git.unlock-music.dev/api/packages/um/npm/ diff --git a/README.MD b/README.MD index 21d1bb6..f5c9113 100644 --- a/README.MD +++ b/README.MD @@ -7,7 +7,7 @@ - Unlock Music 项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循[授权协议]。 - Unlock Music 的 CLI 版本可以在 [unlock-music/cli] 找到,大批量转换建议使用 CLI 版本。 - 我们新建了 Telegram 群组 [`@unlock_music_chat`] ,欢迎加入! -- CI 自动构建已经部署,可以在 [Packages][um-react-packages] 下载。 +- CI 自动构建已经部署,可以在 [Actions][um-react-actions] 下载。 - [常见问题参考](./docs/faq_zh-hans.md) > **WARNING** @@ -17,7 +17,7 @@ [um-vue]: https://git.unlock-music.dev/um/web [unlock-music/cli]: https://git.unlock-music.dev/um/cli [`@unlock_music_chat`]: https://t.me/unlock_music_chat -[um-react-packages]: https://git.unlock-music.dev/um/-/packages/generic/um-react/ +[um-react-actions]: https://git.unlock-music.dev/um/um-react/actions ⚠️ 手机端浏览器支持有限,请使用最新版本的 Chrome 或 Firefox 官方浏览器。 @@ -39,8 +39,11 @@ - [ ] ~~QQ 音乐海外版JOOX Music (`.ofl_en`)~~ [^qm-key-pc]: PC 客户端仅支持 v19.43 或更低版本。 + [^qm-key-android]: 需要获取超级管理员权限后提取密钥数据库,并导入后使用。 + [^qm-key-ios]: 需要越狱获取密钥数据库,或对设备进行完整备份后提取密钥数据库,并导入后使用。 + [^qm-key-mac]: 需要导入密钥数据库。 ## 错误报告 -- 2.45.2