Skip to content

Add swagger

Add swagger #88

name: Lint, Test and Release Charts
on:
push:
branches:
- 'develop'
- 'main'
paths:
- 'helm-chart/kubeinfo-backend/**/*.yaml'
pull_request:
branches:
- 'develop'
- 'main'
paths:
- 'helm-chart/kubeinfo-backend/**/*.yaml'
permissions:
contents: write
jobs:
Lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Get changed files in the helm folder
id: changed-files-helm-chart
uses: tj-actions/changed-files@v40
with:
files_yaml: |
helm:
- helm-chart/kubeinfo-backend/*.{yaml,tpl}
- '!helm-chart/kubeinfo-backend/Chart.yaml'
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --all
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true'
- name: Create kind cluster
uses: helm/[email protected]
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true'
- name: Run chart-testing (install)
run: ct install --config ct.yaml --all
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true'
Release:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
needs: Lint-test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEMANTIC_TOKEN }}
- name: Set up Helm
uses: azure/setup-helm@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Get changed files in the helm folder
id: changed-files-helm-chart
uses: tj-actions/changed-files@v40
with:
files_yaml: |
helm:
- helm-chart/kubeinfo-backend/*.{yaml,tpl}
- '!helm-chart/kubeinfo-backend/Chart.yaml'
chart_version:
- 'helm-chart/kubeinfo-backend/Chart.yaml'
- name: Install PyBump
run: |
python3 -m pip install pybump
shell: bash
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true' && steps.changed-files-helm-chart.outputs.chart_version_any_changed != 'true' && github.ref == 'refs/heads/main'
- name: Automated Version Bump
id: version-bump
run: |
echo "VER=$(pybump bump --file helm-chart/kubeinfo-backend/Chart.yaml --level patch)" >> $GITHUB_OUTPUT
shell: bash
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true' && steps.changed-files-helm-chart.outputs.chart_version_any_changed != 'true' && github.ref == 'refs/heads/main'
- name: Output Name
id: chart-name
run: |
echo "::set-output name=chart::$(basename helm-chart/kubeinfo-backend)"
shell: bash
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true' && steps.changed-files-helm-chart.outputs.chart_version_any_changed != 'true' && github.ref == 'refs/heads/main'
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
if: github.ref == 'refs/heads/main'
- name: GIT Commit
run: |
git add helm-chart/kubeinfo-backend/Chart.yaml
git commit -m "Automatic bump Helm chart version to ${{ steps.version-bump.outputs.VER }}"
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true' && steps.changed-files-helm-chart.outputs.chart_version_any_changed != 'true' && github.ref == 'refs/heads/main'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SEMANTIC_TOKEN }}
if: steps.changed-files-helm-chart.outputs.helm_any_changed == 'true' && steps.changed-files-helm-chart.outputs.chart_version_any_changed != 'true' && github.ref == 'refs/heads/main'
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: helm-chart
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: steps.changed-files-helm-chart.outputs.chart_version_any_changed == 'true' && github.ref == 'refs/heads/main'