publish-chart #442
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: publish-chart | |
| permissions: | |
| packages: write | |
| contents: read | |
| on: | |
| # we only publish the chart after succesful Docker build so we trigger | |
| # a full build when chart templates are changed, this is slightly suboptimal | |
| # TODO automatically bump chart version during build | |
| workflow_run: | |
| workflows: ["publish-image"] | |
| types: [completed] | |
| branches: ["main"] | |
| jobs: | |
| publish-chart: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - chart_name: crosslink-broker | |
| chart_base_version: "0.1.0-main.${{ github.run_number }}" | |
| chart_path: ./broker/chart | |
| md_path: ./broker/descriptors/ModuleDescriptor-template.json | |
| - chart_name: crosslink-illmock | |
| chart_base_version: "0.1.0-main.${{ github.run_number }}" | |
| chart_path: ./illmock/chart | |
| md_path: ./illmock/descriptors/ModuleDescriptor-template.json | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Calculate chart and app version with short SHA | |
| run: | | |
| SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7) | |
| CHART_VERSION="${{ matrix.chart_base_version }}+sha.$SHORT_SHA" | |
| APP_VERSION="sha-$SHORT_SHA" | |
| echo "CHART_VERSION=$CHART_VERSION" >> $GITHUB_ENV | |
| echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV | |
| - name: Process MD for okapi-hooks | |
| if: ${{ matrix.md_path }} | |
| run: | | |
| sed -i "s/@version@/$CHART_VERSION/" ${{ matrix.md_path }} | |
| sed 's/^/ /' ${{ matrix.md_path }} > indented.json | |
| sed -i -e '/@descriptor@/{ | |
| r indented.json | |
| d | |
| }' ${{ matrix.chart_path }}/values.yaml | |
| - name: helm lint | |
| run: | | |
| helm lint ${{ matrix.chart_path }} | |
| - name: helm login | |
| run: | | |
| echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u $ --password-stdin | |
| - name: helm dependency | |
| run: | | |
| helm dependency build ${{ matrix.chart_path }} | |
| - name: helm package | |
| run: | | |
| helm package ${{ matrix.chart_path }} --version "$CHART_VERSION" --app-version "$APP_VERSION" | |
| - name: helm push | |
| run: | | |
| helm push "${{ matrix.chart_name }}-$CHART_VERSION.tgz" oci://ghcr.io/${{ github.repository_owner }}/charts |