TrueChartsClone/.github/workflows/apps.release.yaml

171 lines
5.8 KiB
YAML
Raw Normal View History

name: "Apps: Release"
on:
push:
branches:
- 'master'
tags-ignore:
- '**'
paths:
- 'charts/**/chart.yaml'
- 'charts/**/Chart.yaml'
2021-07-01 09:17:31 +00:00
- '.github/workflows/apps.release.yaml'
- '.github/ct-install.yaml'
- '.github/ct-lint.yaml'
- '.github/cr.yaml'
jobs:
2021-09-07 10:06:07 +00:00
app-release:
concurrency: gitpush
runs-on: ubuntu-latest
container:
image: ixsystems/catalog_validation:latest
steps:
2021-09-07 10:11:16 +00:00
# wait and Prep cache
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
with:
continue-after-seconds: 180
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
2021-08-17 12:10:04 +00:00
- name: Cache helm repo cache
id: cache
uses: actions/cache@v2
with:
key: helmrepocache-${{ github.sha }}
path: |
~/.cache/helm/repository
~/.config/helm/repositories.yaml
2021-09-07 10:11:16 +00:00
# Checkout repo's
- name: Checkout
uses: actions/checkout@v2
with:
2021-09-07 10:11:16 +00:00
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
2021-09-07 10:06:07 +00:00
- name: Configure Git
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
2021-09-07 10:11:16 +00:00
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
2021-08-17 12:10:04 +00:00
2021-09-07 10:11:16 +00:00
# Setup Helm
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.5.3
- name: install chart releaser
run: |
brew tap helm/tap
brew install chart-releaser
2021-09-07 10:06:07 +00:00
- name: update helm repo cache
run: |
helm repo add truecharts https://truecharts.org
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
2021-09-07 10:11:16 +00:00
# HELM Release
2021-09-07 10:06:07 +00:00
2021-09-07 10:11:16 +00:00
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
with:
2021-09-07 10:11:16 +00:00
config: .github/cr.yaml
charts_dir: charts/*
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
2021-09-07 10:06:07 +00:00
2021-09-07 10:11:16 +00:00
# SCALE Release
2021-09-07 10:06:07 +00:00
- name: fetch dependencies
run: |
for train in stable incubator
do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
cd ${chart}
helm dependency update --skip-refresh
cd -
fi
done
done
- name: Remove if release already exists
run: |
2021-08-23 19:32:52 +00:00
for train in stable incubator
do
2021-09-07 10:06:07 +00:00
for chart in charts/${train}/*; do
if [ -d "${chart}/SCALE" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "Processing... cleanup-existing... Chart: ${chartname} - Version: ${maxchartversion}"
rm -Rf catalog/${train}/${chartname}/${maxchartversion} || echo "Chart release ${chartname} with version ${maxchartversion} does not exist yet... Skipping..."
rm -Rf catalog/${train}/${chartname}/item.yaml || echo "No old catalog item.yaml found for ${chartname}"
else
echo "Skipping chart ${chart}, no correct SCALE compatibility layer detected"
fi
done
done
2021-09-07 10:06:07 +00:00
- name: Apply SCALE Patches
run: |
2021-08-23 19:32:52 +00:00
for train in stable incubator
do
2021-09-07 10:06:07 +00:00
for chart in charts/${train}/*; do
if [ -d "${chart}/SCALE" ]; then
chartname=$(basename ${chart})
echo "Processing... Applying SCALE patch... Chart: ${chartname} - Version: ${maxfolderversion}"
mv ${chart}/SCALE/item.yaml ${chart}/
mv ${chart}/SCALE/ix_values.yaml ${chart}/
mv ${chart}/SCALE/questions.yaml ${chart}/
cp -rf ${chart}/SCALE/templates/* ${chart}/templates || echo "ignoring templates directory..."
rm -rf ${chart}/SCALE
mv ${chart}/values.yaml ${chart}/test_values.yaml
touch ${chart}/values.yaml
description=$(cat ${chart}/Chart.yaml | grep "^description: " | sed -r 's/^description: //')
echo "${description}" >> ${chart}/app-readme.md
else
echo "Skipping chart ${chart}, no correct SCALE compatibility layer detected"
fi
done
done
- name: Add Chart release
run: |
2021-08-23 19:32:52 +00:00
for train in stable incubator
do
2021-09-07 10:06:07 +00:00
for chart in charts/${train}/*; do
if [ -f "${chart}/item.yaml" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "Processing... Copying charts... Chart: ${chartname} - Version: ${maxchartversion}"
mkdir -p catalog/${train}/${chartname}/${maxchartversion}
cp -Rf ${chart}/* catalog/${train}/${chartname}/${maxchartversion}/
mv catalog/${train}/${chartname}/${maxchartversion}/item.yaml catalog/${train}/${chartname}/item.yaml
else
echo "Skipping, chart ${chart} does not contain SCALE compatibility layer..."
fi
done
done
- name: Validate catalog format
run: |
cd catalog
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
- name: Commit and Push new App releases
run: |
cd catalog
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Commit new App releases for TrueCharts" || exit 0
git push