2023-06-01 22:52:51 +08:00
|
|
|
name: Update app version in Renovate Branches
|
|
|
|
|
|
|
|
on:
|
2023-09-13 10:48:00 +08:00
|
|
|
push:
|
|
|
|
branches: [ 'renovate/*' ]
|
2023-08-01 16:17:38 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
manual-trigger:
|
|
|
|
description: 'Manually trigger Renovate'
|
|
|
|
default: ''
|
2023-06-01 22:52:51 +08:00
|
|
|
jobs:
|
|
|
|
update-app-version:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-25 16:59:25 +08:00
|
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
|
2023-06-01 22:52:51 +08:00
|
|
|
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)
|
2023-09-10 23:13:06 +08:00
|
|
|
git add "apps/$app_name/*" && git commit -m "Update app version [skip ci]" --no-verify && git push || true
|
2023-06-01 22:52:51 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|