Tweak bump logic

This commit is contained in:
kjeld Schouten-Lebbing 2021-05-23 15:19:20 +02:00
parent 4aa84cfce3
commit 4bb573c7a6
No known key found for this signature in database
GPG Key ID: 4CDAD4A532BC1EDB
1 changed files with 29 additions and 20 deletions

View File

@ -11,15 +11,18 @@ jobs:
renovate-bump: renovate-bump:
name: Get changed Apps name: Get changed Apps
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs:
matrix: "{\"app\": ${{ steps.reduce.outputs.apps }} }"
empty_matrix: ${{ steps.reduce.outputs.empty_matrix }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
name: Checkout name: Checkout
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }} token: ${{ secrets.BOT_TOKEN }}
- uses: actions/checkout@v2
name: Checkout
with:
fetch-depth: 0
ref: master
path: master
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
- name: Install dependencies - name: Install dependencies
@ -39,25 +42,18 @@ jobs:
- 'charts/deprecated/**' - 'charts/deprecated/**'
- 'charts/non-free/**' - 'charts/non-free/**'
- 'charts/library/**' - 'charts/library/**'
- run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json - name: Filter filter-output
- id: reduce run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
run: |
APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/)(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.third_directory)") | unique' changes.json)
echo ::set-output name=apps::${APPS}
if [ -z "${APPS[0]}" ]; then
echo "No Changed Apps"
echo "::set-output name=empty_matrix::true"
else
echo "Changed Apps: ${APPS[*]}"
echo "::set-output name=empty_matrix::false"
fi
- name: Bump - name: Bump
run: | run: |
for chart in ${{ steps.reduce.outputs.apps }}; do APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/)(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.third_directory)") | unique' changes.json | jq -r '.[]')
if "${chart}" == '.gitkee'; then echo "changed apps: ${APPS[*]}"
for chart in ${APPS[*]}
do
if [[ "${chart}" == '.gitkee' ]]; then
echo "Skipping..." echo "Skipping..."
return return
else if test -f "./charts/stable/${chart}/Chart.yaml"; then elif test -f "./charts/stable/${chart}/Chart.yaml"; then
train="stable" train="stable"
elif test -f "./charts/incubator/${chart}/Chart.yaml"; then elif test -f "./charts/incubator/${chart}/Chart.yaml"; then
train="incubator" train="incubator"
@ -70,10 +66,23 @@ jobs:
else else
train="develop" train="develop"
fi fi
$pybump bump --file ./charts/${train}/${chart}/Chart.yaml --level patch echo "Comparing versions for ${train}/${chart}"
master=$(pybump get --file ./master/charts/${train}/${chart}/Chart.yaml)
current=$(pybump get --file ./charts/${train}/${chart}/Chart.yaml)
echo "master version: ${master}"
echo "current version: ${current}"
if [[ "${master}" != "${current}" ]]; then
echo "Version does not have to be bumped"
else
echo "Bumping patch version for ${train}/${chart}"
pybump bump --file ./charts/${train}/${chart}/Chart.yaml --level patch
fi
done done
- name: Cleanup
run: |
rm -rf changes.json
rm -rf master
- name: Commit and Push new version - name: Commit and Push new version
if: ${{ needs.pre-release.outputs.release == 'true' }}
run: | run: |
git config user.name "TrueCharts-Bot" git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org" git config user.email "bot@truecharts.org"