Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release发布流程 #41

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release-buildup

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Run script
run: python3 make_release.py

- name: Publish release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
files: dist/*
3 changes: 2 additions & 1 deletion buildup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
PLATFORM = platform.system()
ARCHITECTURE = platform.machine()
APP_NAME = "lrcapi"
APP_VERSION = "1.5.2"
APP_VERSION = "1.5.3"
PACK_NAME = f"{APP_NAME}-{APP_VERSION}-{PLATFORM}-{ARCHITECTURE}{'.exe' if PLATFORM == 'Windows' else ''}"

# 针对Alpine,安装objdump/gcc环境等
Expand All @@ -19,6 +19,7 @@
subprocess.run("pip install -r requirements.txt", shell=True)
subprocess.run("pip install pyinstaller", shell=True)


# 打包
def generate_add_data_options(root_dir):
options = []
Expand Down
18 changes: 18 additions & 0 deletions make_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import subprocess


platforms = ['linux/amd64', 'linux/arm64/v8', 'linux/arm/v7', 'linux/386', 'windows/amd64']
base_image = 'python:3.11'

# 将此脚本所在的根目录(项目目录)挂载到容器的 /app 目录下
root_dir = os.path.dirname(os.path.abspath(__file__))
container_root_dir = '/app'

# 在容器内使用buildup.py脚本自动化完成依赖安装、打包等操作
command_in_docker = "python /app/buildup.py"

for platform in platforms:
# 使用docker run命令在不同平台的容器中执行打包命令
command = f"docker run --rm -v {root_dir}:{container_root_dir} --platform {platform} {base_image} {command_in_docker}"
subprocess.run(command, shell=True)
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<p class="has-line-data" data-line-start="2" data-line-end="3">A Flask API For <a
target="_blank" href="https://github.com/gitbobobo/StreamMusic">StreamMusic</a></p>
<a target="_blank" href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/Python-3.10|3.11|3.12-blue.svg" alt=""></a>
<a target="_blank" href="https://hub.docker.com/r/hisatri/lyricapi"><img src="https://img.shields.io/badge/Docker-Quick%20Start-0077ED.svg" alt=""></a>
<a target="_blank" href="https://hub.docker.com/r/hisatri/lrcapi"><img src="https://img.shields.io/badge/Docker-Quick%20Start-0077ED.svg" alt=""></a>
<br>
<a target="_blank" href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://img.shields.io/github/license/HisAtri/LrcApi?color=%23f280bf" alt=""></a>
<img src="https://img.shields.io/github/commit-activity/m/HisAtri/LrcApi?color=%23bf4215" alt="">
Expand Down Expand Up @@ -103,10 +103,10 @@ <h3 class="code-line" data-line-start=39 data-line-end=40><a id="Python_39"></a>
<p class="has-line-data" data-line-start="45" data-line-end="46">
启动服务:<code>python3 app.py --port 8080 --auth 自定义一个鉴权key</code></p>
<h3 class="code-line" data-line-start=47 data-line-end=48><a id="Docker_47"></a>Docker部署方式</h3>
<pre><code data-line-start="50" data-line-end="52" class="language-bash">docker run <span class="hljs-operator">-d</span> -p <span class="hljs-number">28883</span>:<span class="hljs-number">28883</span> -v /home/user/music:/music hisatri/lyricapi:latest
<pre><code data-line-start="50" data-line-end="52" class="language-bash">docker run <span class="hljs-operator">-d</span> -p <span class="hljs-number">28883</span>:<span class="hljs-number">28883</span> -v /home/user/music:/music hisatri/lrcapi:latest
</code></pre>
<p class="has-line-data" data-line-start="53" data-line-end="54">或者,请指定一个Tag(推荐)</p>
<pre><code data-line-start="56" data-line-end="58" class="language-bash">docker run <span class="hljs-operator">-d</span> -p <span class="hljs-number">28883</span>:<span class="hljs-number">28883</span> -v /home/user/music:/music hisatri/lyricapi:alpine-py1.<span class="hljs-number">3.4</span>
<pre><code data-line-start="56" data-line-end="58" class="language-bash">docker run <span class="hljs-operator">-d</span> -p <span class="hljs-number">28883</span>:<span class="hljs-number">28883</span> -v /home/user/music:/music hisatri/lrcapi:alpine-py1.<span class="hljs-number">3.4</span>
</code></pre>
<p class="has-line-data" data-line-start="59" data-line-end="60">如果你正在使用Navidrome Docker,请将
<code>/home/user/music:/music</code> 中的 <code>/home/user/music</code> 修改为你在Navidrome中映射的主机路径;</p>
Expand Down
Loading