fix(security): constant-time token compare, validate OIDC port param … #20
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 OCI Image Build and Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| jobs: | |
| build-hub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Helm | |
| uses: azure/setup-helm@v3 | |
| with: | |
| version: 'v3.12.0' | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/faroshq/kedge-hub | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha | |
| - name: Package and push Helm charts as OCI | |
| env: | |
| HELM_EXPERIMENTAL_OCI: 1 | |
| run: | | |
| # Login to GitHub Container Registry for Helm | |
| echo "${{ github.token }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin | |
| # Set chart version - use tag name if available, otherwise use semver format | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| CHART_VERSION="${{ github.ref_name }}" | |
| # Remove 'v' prefix if present | |
| CHART_VERSION="${CHART_VERSION#v}" | |
| else | |
| CHART_VERSION="0.0.0-${{ github.sha }}" | |
| fi | |
| # Package and push each chart in deploy/charts/ | |
| for chart_dir in deploy/charts/*/; do | |
| if [ -f "${chart_dir}Chart.yaml" ]; then | |
| chart_name=$(basename "$chart_dir") | |
| echo "Processing chart: $chart_name" | |
| # Update chart version and appVersion in Chart.yaml | |
| sed -i "s/^version:.*/version: ${CHART_VERSION}/" "${chart_dir}Chart.yaml" | |
| sed -i "s/^appVersion:.*/appVersion: ${CHART_VERSION}/" "${chart_dir}Chart.yaml" | |
| # Package the chart | |
| helm package "$chart_dir" --version "${CHART_VERSION}" | |
| # Push to GitHub Container Registry | |
| helm push "${chart_name}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts" | |
| echo "Helm chart pushed to oci://ghcr.io/${{ github.repository_owner }}/charts/${chart_name}:${CHART_VERSION}" | |
| fi | |
| done |