-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7bf913
commit 24caca1
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# This script copies the version from docker-compose.yml to config.json. | ||
|
||
app_name=$1 | ||
old_version=$2 | ||
|
||
# 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 | ||
# 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) | ||
|
||
# Only apply changes if the format is <image>:<version> | ||
if [[ "$image" == *":"* ]]; then | ||
version=$(cut -d ":" -f2- <<< "$image") | ||
|
||
# Trim the "v" prefix | ||
trimmed_version=${version/#"v"} | ||
|
||
mv apps/$app_name/$old_version apps/$app_name/$trimmed_version | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Update app version in Renovate Branches | ||
|
||
on: | ||
push: | ||
branches: [ 'renovate/*' ] | ||
|
||
jobs: | ||
update-app-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
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" --no-verify && git push || true | ||
fi | ||
done | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Renovate | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
manual-trigger: | ||
description: 'Manually trigger Renovate' | ||
default: '' | ||
|
||
jobs: | ||
renovate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3.3.0 | ||
- name: Run Renovate | ||
uses: renovatebot/github-action@v38.1.0 | ||
with: | ||
useSlim: false | ||
token: ${{ secrets.GITHUBTOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:base"], | ||
"gitIgnoredAuthors": [ | ||
"githubaction@githubaction.com" | ||
], | ||
"packageRules": [ | ||
{ | ||
"packageNames": ["docker-compose"], | ||
"automerge": true | ||
} | ||
], | ||
"prCreation": "immediate" | ||
} |