update chart defaults and routing behavior for Contour plus Knative #3
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: helm | |
| on: | |
| pull_request: | |
| paths: | |
| - "charts/**" | |
| - ".github/workflows/helm.yaml" | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| paths: | |
| - "charts/**" | |
| - ".github/workflows/helm.yaml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Compute package version | |
| shell: bash | |
| run: | | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" == v* ]]; then | |
| echo "CHART_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Lint chart | |
| run: helm lint ./charts | |
| - name: Package chart | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [[ -n "${CHART_VERSION:-}" ]]; then | |
| helm package ./charts --destination dist --version "$CHART_VERSION" --app-version "$CHART_VERSION" | |
| else | |
| helm package ./charts --destination dist | |
| fi | |
| - name: Upload chart package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: helm-chart-package | |
| path: dist/*.tgz | |
| publish: | |
| if: github.event_name == 'push' | |
| needs: package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Setup ORAS | |
| uses: oras-project/setup-oras@v1 | |
| - name: Compute package version | |
| shell: bash | |
| run: | | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" && "${GITHUB_REF_NAME}" == v* ]]; then | |
| echo "CHART_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Package chart | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [[ -n "${CHART_VERSION:-}" ]]; then | |
| helm package ./charts --destination dist --version "$CHART_VERSION" --app-version "$CHART_VERSION" | |
| else | |
| helm package ./charts --destination dist | |
| fi | |
| - name: Compute OCI registry path | |
| shell: bash | |
| run: | | |
| OWNER_LC="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')" | |
| echo "OCI_REPO=oci://ghcr.io/${OWNER_LC}/helm" >> "$GITHUB_ENV" | |
| echo "OCI_REPO_PLAIN=ghcr.io/${OWNER_LC}/helm" >> "$GITHUB_ENV" | |
| - name: Login to GHCR | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - name: Login to GHCR with ORAS | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - name: Push chart to GHCR | |
| shell: bash | |
| run: | | |
| helm push dist/*.tgz "$OCI_REPO" | |
| - name: Tag main build as latest | |
| if: github.ref == 'refs/heads/main' | |
| shell: bash | |
| run: | | |
| CHART_NAME="$(helm show chart ./charts | awk '/^name:/ {print $2}')" | |
| CHART_VERSION="$(helm show chart dist/*.tgz | awk '/^version:/ {print $2}')" | |
| oras cp \ | |
| "${OCI_REPO_PLAIN}/${CHART_NAME}:${CHART_VERSION}" \ | |
| "${OCI_REPO_PLAIN}/${CHART_NAME}:latest" |