mirror of
https://github.com/QYG2297248353/appstore-1panel.git
synced 2024-11-24 14:53:52 +08:00
修复 renovate
Signed-off-by: 萌森 <qyg2297248353@163.com>
This commit is contained in:
parent
2fa4674686
commit
a2d9b8988a
34
.github/workflows/renovate-app-version.sh
vendored
34
.github/workflows/renovate-app-version.sh
vendored
@ -4,33 +4,53 @@
|
||||
app_name=$1
|
||||
old_version=$2
|
||||
|
||||
# find all docker-compose files under apps/$app_name (there should be only one)
|
||||
echo "Processing app: $app_name, old version: $old_version"
|
||||
|
||||
# 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)
|
||||
|
||||
for docker_compose_file in $docker_compose_files
|
||||
do
|
||||
echo "Processing docker-compose file: $docker_compose_file"
|
||||
|
||||
# Assuming that the app version will be from the first docker image
|
||||
first_service=$(yq '.services | keys | .[0]' $docker_compose_file)
|
||||
|
||||
image=$(yq .services.$first_service.image $docker_compose_file)
|
||||
|
||||
echo "Found image: $image"
|
||||
|
||||
# Only apply changes if the format is <image>:<version>
|
||||
if [[ "$image" == *":"* ]]; then
|
||||
version=$(cut -d ":" -f2- <<< "$image")
|
||||
|
||||
echo "Extracted version: $version"
|
||||
|
||||
# Trim the "v" prefix
|
||||
trimmed_version=${version/#"v"}
|
||||
|
||||
echo "Trimmed version: $trimmed_version"
|
||||
|
||||
# Remove any suffixes (like -ffmpeg) for versioning purposes
|
||||
cleaned_version=$(echo $trimmed_version | grep -oE '^[0-9]+(\.[0-9]+){0,4}')
|
||||
|
||||
echo "Cleaned version: $cleaned_version"
|
||||
|
||||
# Handle special versions with dates and other formats
|
||||
if [[ "$trimmed_version" =~ ^[0-9]+(\.[0-9]+){0,3}$ ]]; then
|
||||
# Extract the version part which can be 1 to 4 segments
|
||||
trimmed_version=$(echo $trimmed_version | grep -oE '^[0-9]+(\.[0-9]+){0,4}')
|
||||
elif [[ "$trimmed_version" =~ ^RELEASE\.[0-9]{4}-[0-9]{2}-[0-9]{2} ]]; then
|
||||
if [[ -z "$cleaned_version" && "$trimmed_version" =~ ^RELEASE\.[0-9]{4}-[0-9]{2}-[0-9]{2} ]]; then
|
||||
# Handle minio version format RELEASE.YYYY-MM-DDTHH-MM-SSZ
|
||||
trimmed_version=$(echo $trimmed_version | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}')
|
||||
cleaned_version=$(echo $trimmed_version | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}')
|
||||
fi
|
||||
|
||||
echo "Final version: $cleaned_version"
|
||||
|
||||
# Move to the new versioned directory
|
||||
mv apps/$app_name/$old_version apps/$app_name/$trimmed_version
|
||||
if [[ -n "$cleaned_version" ]]; then
|
||||
mv apps/$app_name/$old_version apps/$app_name/$cleaned_version
|
||||
|
||||
echo "Moved $old_version to $cleaned_version"
|
||||
else
|
||||
echo "Could not determine version for image: $image"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
7
.github/workflows/renovate-app-version.yml
vendored
7
.github/workflows/renovate-app-version.yml
vendored
@ -8,6 +8,7 @@ on:
|
||||
manual-trigger:
|
||||
description: 'Manually trigger Renovate'
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
update-app-version:
|
||||
runs-on: ubuntu-latest
|
||||
@ -26,15 +27,16 @@ jobs:
|
||||
id: updated-files
|
||||
run: |
|
||||
echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | tr '\n' ' ')"
|
||||
echo "Updated files: ${{ steps.updated-files.outputs.files }}"
|
||||
|
||||
- name: Run renovate-app-version.sh on updated files
|
||||
run: |
|
||||
IFS=' ' read -ra files <<< "${{ steps.updated-files.outputs.files }}"
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file == *"docker-compose.yml"* ]]; then
|
||||
app_name=$(echo $file | cut -d'/' -f 2)
|
||||
old_version=$(echo $file | cut -d'/' -f 3)
|
||||
echo "Running script for app: $app_name, old version: $old_version"
|
||||
chmod +x .github/workflows/renovate-app-version.sh
|
||||
.github/workflows/renovate-app-version.sh $app_name $old_version
|
||||
fi
|
||||
@ -43,11 +45,10 @@ jobs:
|
||||
- name: Commit & Push Changes
|
||||
run: |
|
||||
IFS=' ' read -ra files <<< "${{ steps.updated-files.outputs.files }}"
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file == *"docker-compose.yml"* ]]; then
|
||||
app_name=$(echo $file | cut -d'/' -f 2)
|
||||
echo "Committing changes for app: $app_name"
|
||||
git add "apps/$app_name/*" && git commit -m "Update app version [skip ci]" --no-verify && git push || true
|
||||
fi
|
||||
done
|
||||
|
||||
|
53
.github/workflows/renovate-app-version.yml.bac
vendored
Normal file
53
.github/workflows/renovate-app-version.yml.bac
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Update app version in Renovate Branches
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'renovate/*' ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
manual-trigger:
|
||||
description: 'Manually trigger Renovate'
|
||||
default: ''
|
||||
jobs:
|
||||
update-app-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure repo
|
||||
run: |
|
||||
git config --local user.email "githubaction@githubaction.com"
|
||||
git config --local user.name "github-action update-app-version"
|
||||
|
||||
- name: Get list of updated files by the last commit in this branch separated by space
|
||||
id: updated-files
|
||||
run: |
|
||||
echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | tr '\n' ' ')"
|
||||
|
||||
- name: Run renovate-app-version.sh on updated files
|
||||
run: |
|
||||
IFS=' ' read -ra files <<< "${{ steps.updated-files.outputs.files }}"
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file == *"docker-compose.yml"* ]]; then
|
||||
app_name=$(echo $file | cut -d'/' -f 2)
|
||||
old_version=$(echo $file | cut -d'/' -f 3)
|
||||
chmod +x .github/workflows/renovate-app-version.sh
|
||||
.github/workflows/renovate-app-version.sh $app_name $old_version
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Commit & Push Changes
|
||||
run: |
|
||||
IFS=' ' read -ra files <<< "${{ steps.updated-files.outputs.files }}"
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ $file == *"docker-compose.yml"* ]]; then
|
||||
app_name=$(echo $file | cut -d'/' -f 2)
|
||||
git add "apps/$app_name/*" && git commit -m "Update app version [skip ci]" --no-verify && git push || true
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user