feat:调整文件结构以适配上游renovate
49
.github/workflows/renovate-app-version.sh
vendored
@ -1,49 +1,26 @@
|
||||
#!/bin/bash
|
||||
# 此脚本将docker-compose.yml文件中的版本号复制到config.json文件中。
|
||||
# This script copies the version from docker-compose.yml to config.json.
|
||||
|
||||
app_name=$1
|
||||
old_version=$2
|
||||
|
||||
# 查找/$app_name目录下的所有docker-compose文件(应该只有一个)
|
||||
docker_compose_files=$(find $app_name/$old_version -name docker-compose.yml)
|
||||
# find all docker-compose files under apps/$app_name (there should be only one)
|
||||
docker_compose_files=$(find apps/$app_name/$old_version -name docker-compose.yml)
|
||||
|
||||
# 声明一个关联数组,用于存储每个app_name对应的排除版本号
|
||||
declare -A excluded_versions
|
||||
excluded_versions["qBittorrent"]="4.3.5"
|
||||
excluded_versions["php-unofficial"]="all"
|
||||
# 如果需要,可以添加更多的排除版本号
|
||||
|
||||
# 遍历每个docker-compose文件
|
||||
for docker_compose_file in $docker_compose_files
|
||||
do
|
||||
# 如果app_name和版本号匹配了排除版本号,跳过处理
|
||||
if [[ "${excluded_versions[$app_name]}" == "all" ]]; then
|
||||
continue
|
||||
fi
|
||||
# Assuming that the app version will be from the first docker image
|
||||
first_service=$(yq '.services | keys | .[0]' $docker_compose_file)
|
||||
|
||||
# 假设应用的版本号位于第一个docker镜像的标签中
|
||||
first_service=$(yq '.services | keys | .[0]' $docker_compose_file)
|
||||
image=$(yq .services.$first_service.image $docker_compose_file)
|
||||
|
||||
# 获取镜像名称
|
||||
image=$(yq .services.$first_service.image $docker_compose_file)
|
||||
# Only apply changes if the format is <image>:<version>
|
||||
if [[ "$image" == *":"* ]]; then
|
||||
version=$(cut -d ":" -f2- <<< "$image")
|
||||
|
||||
# 只有当镜像名称的格式为<image>:<version>时才应用更改
|
||||
if [[ "$image" == *":"* ]]; then
|
||||
# 提取版本号
|
||||
version=$(cut -d ":" -f2- <<< "$image")
|
||||
# Trim the "v" prefix
|
||||
trimmed_version=${version/#"v"}
|
||||
|
||||
# 去掉版本号开头的"v"前缀
|
||||
trimmed_version=${version/#"v"}
|
||||
|
||||
# 如果app_name和版本号匹配了排除版本号,跳过处理
|
||||
if [[ "${excluded_versions[$app_name]}" == "$trimmed_version" ]]; then
|
||||
continue
|
||||
mv apps/$app_name/$old_version apps/$app_name/$trimmed_version
|
||||
fi
|
||||
|
||||
# 获取当前docker-compose文件所在的目录路径
|
||||
current_directory=$(dirname "$docker_compose_file")
|
||||
|
||||
# 修改当前目录名为提取的版本号
|
||||
mv "$current_directory" "$app_name/$trimmed_version"
|
||||
fi
|
||||
done
|
||||
done
|
||||
2
.github/workflows/renovate-app-version.yml
vendored
@ -43,6 +43,6 @@ jobs:
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file == *"docker-compose.yml"* ]]; then
|
||||
app_name=$(echo $file | cut -d'/' -f 2)
|
||||
git add "$app_name/*" && git commit -m "Update app version" --no-verify && git push || true
|
||||
git add "apps/$app_name/*" && git commit -m "Update app version" --no-verify && git push || true
|
||||
fi
|
||||
done
|
||||
|
||||
20
README.md
@ -8,15 +8,24 @@
|
||||
|
||||
|
||||
### 2.1
|
||||
- 当`/opt/1panel/resource/apps/local`文件夹下没有任何内容,则可以
|
||||
- 方式一:使用`git` 方式获取应用到`/opt/1panel/resource/apps/local`文件夹下
|
||||
|
||||
```shell
|
||||
git clone -b localApps https://github.com/okxlin/appstore /opt/1panel/resource/apps/local
|
||||
# 克隆名为 localApps 的分支的仓库到 /opt/1panel/resource/apps/local 目录下
|
||||
git clone -b localApps https://github.com/okxlin/appstore /opt/1panel/resource/apps/local
|
||||
|
||||
# 将 /opt/1panel/resource/apps/local/apps 目录下的所有文件移动到 /opt/1panel/resource/apps/local/ 目录下
|
||||
mv /opt/1panel/resource/apps/local/apps/* /opt/1panel/resource/apps/local/
|
||||
|
||||
# 删除 /opt/1panel/resource/apps/local/apps 目录及其内容
|
||||
rm -r /opt/1panel/resource/apps/local/apps
|
||||
|
||||
```
|
||||
|
||||
然后应用商店刷新本地应用即可。
|
||||
|
||||
### 2.2
|
||||
- 当`/opt/1panel/resource/apps/local`文件夹下已经存在文件内容,
|
||||
- 方式二:使用压缩包方式获取应用到`/opt/1panel/resource/apps/local`文件夹下
|
||||
|
||||
```shell
|
||||
cd /opt/1panel/resource/apps/local # 进入目标目录
|
||||
@ -25,9 +34,9 @@ wget https://github.com/okxlin/appstore/archive/refs/heads/localApps.zip # 从G
|
||||
|
||||
unzip localApps.zip # 解压下载的ZIP文件
|
||||
|
||||
cd appstore-localApps # 进入解压后的目录
|
||||
cd ./appstore-localApps/apps # 进入解压后的目录
|
||||
|
||||
mv ./* .. # 将所有文件和目录移动到父目录中
|
||||
mv ./* /opt/1panel/resource/apps/local/ # 将所有文件和目录移动到指定目录中
|
||||
|
||||
cd /opt/1panel/resource/apps/local # 进入目标目录
|
||||
|
||||
@ -37,7 +46,6 @@ rm /opt/1panel/resource/apps/local/localApps.zip # 删除下载的ZIP文件
|
||||
|
||||
```
|
||||
|
||||
|
||||
然后应用商店刷新本地应用即可。
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |