fspiers/ENT-3334/incremental-sync-batch-2 #30
Workflow file for this run
This file contains hidden or 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: "Pull Request GitGuardian" | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| branches: | |
| - main | |
| jobs: | |
| lint-test: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.list-changed.outputs.changed }} | |
| changedCharts: ${{ steps.list-changed.outputs.changedCharts }} | |
| steps: | |
| - name: Setup Helm | |
| uses: Azure/[email protected] | |
| with: | |
| version: 'v3.19.2' | |
| - name: Checkout pull request branch | |
| uses: actions/[email protected] | |
| with: | |
| ref: ${{ github.head_ref }} | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| fetch-depth: 0 | |
| # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and | |
| # yamllint (https://github.com/adrienverge/yamllint) which require Python | |
| - name: Set up Python | |
| uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | |
| with: | |
| python-version: 3.13 | |
| - name: Set up chart-testing-action | |
| uses: helm/[email protected] | |
| - name: Get changed charts | |
| id: list-changed | |
| run: | | |
| changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | |
| if [[ -n "$changed" ]]; then | |
| echo "Changed charts:" | |
| echo "$changed" | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo 'changedCharts<<EOF' >> $GITHUB_OUTPUT | |
| echo $changed >> $GITHUB_OUTPUT | |
| echo 'EOF' >> $GITHUB_OUTPUT | |
| else | |
| echo "No chart changes detected" | |
| fi | |
| - name: Installing plugin helm-unittest | |
| if: steps.list-changed.outputs.changed == 'true' | |
| run: helm plugin install https://github.com/helm-unittest/helm-unittest >/dev/null | |
| - name: Run chart testing (lint & unittest) | |
| if: steps.list-changed.outputs.changed == 'true' | |
| run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false --additional-commands "helm unittest {{ .Path }}" | |
| publish-chart: | |
| name: Publish Helm Chart | |
| needs: [lint-test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: azure/[email protected] | |
| with: | |
| version: 'v3.19.2' | |
| - name: Checkout pull request branch | |
| uses: actions/[email protected] | |
| with: | |
| ref: ${{ github.head_ref }} | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| fetch-depth: 0 | |
| - name: Set up chart-testing-action | |
| uses: helm/[email protected] | |
| - name: Get changed charts | |
| id: list-changed | |
| run: | | |
| changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | |
| if [[ -n "$changed" ]]; then | |
| echo "Changed charts:" | |
| echo "$changed" | |
| changed_list=$(echo "$changed" | tr '\n' ',' | sed 's/,$//') | |
| echo "changed=$changed_list" >> $GITHUB_OUTPUT | |
| else | |
| echo "No chart changes detected" | |
| fi | |
| - name: Publish Helm chart to ttl | |
| id: upload | |
| if: ${{ steps.list-changed.outputs.changed }} | |
| run: | | |
| CHANGED_CHARTS="${{ steps.list-changed.outputs.changed }}" | |
| RELEASED_CHARTS="" | |
| for chart_directory in ${CHANGED_CHARTS//,/ }; do | |
| CHART_NAME=${chart_directory#charts/} | |
| cd $chart_directory | |
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
| CHART_VERSION="0.1.0-${{ github.run_number }}" | |
| APP_VERSION="unstable-${SHORT_SHA}" | |
| helm dep update . | |
| helm lint --strict . | |
| helm package . --app-version=${APP_VERSION} --version=${CHART_VERSION} | |
| # Push to GHCR | |
| echo "Pushing Helm chart $CHART_NAME-$CHART_VERSION.tgz to oci://ttl.sh/${{ github.event.repository.name }}" | |
| if helm push ./$CHART_NAME-$CHART_VERSION.tgz oci://ttl.sh/${{ github.event.repository.name }}; then | |
| echo "Successfully released $CHART_NAME-$CHART_VERSION to ttl.sh" | |
| else | |
| echo "Failed to push $CHART_NAME-$CHART_VERSION to ttl.sh" | |
| exit 1 | |
| fi | |
| cd ${{ github.workspace }} | |
| done | |
| echo "released_charts=$RELEASED_CHARTS" >> "$GITHUB_OUTPUT" |