Merge pull request #8 from GateNLP/teamware-2.2.0 #16
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
name: Publish updated charts | |
on: | |
push: | |
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 }} | |
publish-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 | |
uses: actions/checkout@v4 | |
- name: Publish chart to GATE repository | |
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 | |
# Fetch dependency charts | |
helm dependency build | |
# Build the tgz package | |
helm package . | |
# Upload it to GATE repo | |
curl -u '${{ secrets.GATE_REPO_USERNAME }}:${{ secrets.GATE_REPO_PASSWORD }}' https://repo.gate.ac.uk/repository/charts/ --upload-file ${{ matrix.chart }}-*.tgz |