Skip to content

Chart for Teamware 2.2.0 #18

Chart for Teamware 2.2.0

Chart for Teamware 2.2.0 #18

Workflow file for this run

name: Pull Request Checks
on:
pull_request:
branches:
- main
jobs:
find-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find modified folders
id: changed-dirs
uses: tj-actions/changed-files@v42
with:
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: "1"
- name: Filter for just modified charts
id: changed-charts
run: |
echo "Changed directories: ${{ steps.changed-dirs.outputs.all_changed_files }}"
(
echo -n 'matrix='
for dir in ${{ steps.changed-dirs.outputs.all_changed_files }} ; do
[ -f $dir/Chart.yaml ] && echo "$dir"
done | jq -nRc '[inputs | select(length>0)]'
) >> $GITHUB_OUTPUT
outputs:
changed-charts: ${{ steps.changed-charts.outputs.matrix }}
check-chart:
runs-on: ubuntu-latest
needs: find-charts
if: needs.find-charts.outputs.changed-charts != '[]'
strategy:
matrix:
chart: ${{ fromJSON(needs.find-charts.outputs.changed-charts) }}
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Lockfile exists for ${{ matrix.chart }}
run: |
if yq -e eval .dependencies ${{ matrix.chart }}/Chart.yaml >/dev/null 2>&1 ; then
if ! [ -f ${{ matrix.chart }}/Chart.lock ] ; then
echo "Chart ${{ matrix.chart }} has dependencies but no Chart.lock!"
exit 1
fi
else
echo "Chart ${{ matrix.chart }} has no dependencies, lockfile not required"
fi
- name: Version has changed for ${{ matrix.chart }}
run: |
# Fetch latest commit of main so we have a base to compare to
git fetch --deepen=1 origin +refs/heads/main:refs/remotes/origin/main
if (
echo "old:"
git show origin/main:${{ matrix.chart }}/Chart.yaml | sed 's/^/ /'
echo "new:"
cat ${{ matrix.chart }}/Chart.yaml | sed 's/^/ /'
) | yq -e eval '.old.version != .new.version' - ; then
echo "Chart version has been updated by this PR"
else
echo "PR has modified chart ${{ matrix.chart }} but has not changed the chart version number!"
exit 1
fi
- name: Chart ${{ matrix.chart }} will package correctly
run: |
set -e
cd ${{ matrix.chart }}
# Add repositories specified in the lock file, so helm dependency build can work
if [ -f "./Chart.lock" ]; then
yq --indent 0 '.dependencies | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' "./Chart.lock" | sh --;
fi
helm dependency build
helm package .
# Final job to summarize the matrix, so it can be used in branch protection rules
charts-ok:
runs-on: ubuntu-latest
needs: check-chart
if: always()
steps:
- name: Some chart failed
if: needs.check-chart.result == 'failure'
run: |
echo "One or more charts failed validation"
exit 1
- name: Chck was cancelled
if: needs.check-chart.result == 'cancelled'
run: |
echo "Chart validation was cancelled"
exit 1
- name: All charts OK
if: needs.check-chart.result == 'success'
run: echo "All charts are OK"
- name: No charts were modified
if: needs.check-chart.result == 'skipped'
run: echo "No charts were modified by this PR"