Update .drone.yml
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
ca97fa520f
commit
756d5be721
1 changed files with 41 additions and 0 deletions
41
.drone.yml
41
.drone.yml
|
@ -33,3 +33,44 @@ steps:
|
|||
- "yamllint --version"
|
||||
- 'find . -name "*.yml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
||||
- 'find . -name "*.yaml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: gitea
|
||||
|
||||
name: update-branch-on-push
|
||||
|
||||
# This triggers the pipeline only when there's a push to the "main" branch.
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
|
||||
# Define steps for the pipeline
|
||||
steps:
|
||||
- name: Checkout code
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
# Find subfolders with docker-compose.yml files
|
||||
- name: Find folders to update
|
||||
script: |
|
||||
folders=$(find . -type d -name 'docker-compose.yml' | sed 's/\/docker-compose\.yml//g' | uniq)
|
||||
echo "Found folders: $folders"
|
||||
|
||||
# Loop through each folder and update its branch
|
||||
- name: Update branches
|
||||
template: |
|
||||
{{ range $folder := $folders }}
|
||||
- name: Update {{ $folder }} branch
|
||||
commands:
|
||||
- git fetch origin {{ $folder }}
|
||||
- git checkout {{ $folder }}
|
||||
- git rebase origin/main
|
||||
- git push origin {{ $folder }}
|
||||
{{ end }}
|
||||
|
||||
# This condition ensures the pipeline runs only if there are changes to any folder
|
||||
when:
|
||||
- expression: |
|
||||
git diff --name-only origin/main HEAD | grep -E '\.(yml|yaml)'
|
||||
|
|
Reference in a new issue