Merge pull request #834 from dsmf/chore/542-default-policy-config-imp… #108
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: Release Helm Charts | |
on: | |
workflow_dispatch: # Trigger manually | |
push: | |
branches: | |
- main | |
paths: | |
- 'charts/**' | |
jobs: | |
get-helm-charts-versions-irs: | |
outputs: | |
latest_version: ${{ steps.step1.outputs.latest_version }} | |
current_version: ${{ steps.step2.outputs.current_version }} | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get helm charts latest tag version | |
id: step1 | |
run: | | |
latestVersion=$(git tag | grep "item-relationship-service-[1-9]" | sort -V | tail -1) | |
echo "::set-output name=latest_version::$latestVersion" | |
echo "Exported $latestVersion latest helm charts version" | |
- name: Get helm charts current version | |
id: step2 | |
run: | | |
chartVersion=item-relationship-service-$(cat ./charts/item-relationship-service/Chart.yaml | grep "version:" | head -1 | cut -d ":" -d " " -f2) | |
echo "::set-output name=current_version::$chartVersion" | |
echo "Exported $chartVersion helm charts version" | |
release: | |
needs: "get-helm-charts-versions-irs" | |
if: needs.get-helm-charts-versions-irs.outputs.latest_version != needs.get-helm-charts-versions-irs.outputs.current_version | |
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions | |
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.9.3 | |
- name: Update helm dependencies for irs | |
working-directory: charts/item-relationship-service/ | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo add minio https://charts.min.io/ | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo add grafana https://grafana.github.io/helm-charts | |
helm dependency update | |
- name: Create temporary CHANGELOG file for helm release | |
working-directory: charts/item-relationship-service/ | |
run: | | |
touch CHANGELOG-temp.md | |
currentVersionNumber=$(echo ${{ needs.get-helm-charts-versions-irs.outputs.current_version }} | sed -e "s/^item-relationship-service-//" ) | |
echo currentVersionNumber=$currentVersionNumber | |
sed -n -e '/## \['"${currentVersionNumber}"'\]/,/## \[/ p' CHANGELOG.md | head -n -1 | tail -n +2 >> CHANGELOG-temp.md | |
echo **Full Changelog**: ${{ github.server_url }}/${{ github.repository }}/compare/${{ needs.get-helm-charts-versions-irs.outputs.latest_version }}...${{ needs.get-helm-charts-versions-irs.outputs.current_version }} >> CHANGELOG-temp.md | |
echo "cat CHANGELOG-temp.md" | |
cat CHANGELOG-temp.md | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
config: ./.github/configs/cr-config.yml | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |