Skip to content

Commit 7dd8a89

Browse files
fix(helm-publish): login to OCI registry before dependency update
Move registry authentication earlier in the workflow to enable pulling OCI chart dependencies. This fixes 401 Unauthorized errors when charts have dependencies stored in OCI registries like GHCR. - Add docker/login-action before dependency resolution - Add helm registry login for OCI dependency pulls - Remove duplicate login step that was after dependency update
1 parent 01ce0b1 commit 7dd8a89

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/helm-publish.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,21 @@ jobs:
127127
echo "path=$REPO_PATH" >> $GITHUB_OUTPUT
128128
echo "Repository path: $REPO_PATH"
129129
130+
# Login early to enable pulling OCI dependencies
131+
- name: Log in to OCI registry
132+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
133+
with:
134+
registry: ${{ inputs.registry }}
135+
username: ${{ secrets.registry-username || github.actor }}
136+
password: ${{ secrets.registry-password || secrets.GITHUB_TOKEN }}
137+
138+
- name: Log in to Helm OCI registry
139+
run: |
140+
echo "${{ secrets.registry-password || secrets.GITHUB_TOKEN }}" | \
141+
helm registry login ${{ inputs.registry }} \
142+
--username "${{ secrets.registry-username || github.actor }}" \
143+
--password-stdin
144+
130145
- name: Add Helm repositories
131146
working-directory: ${{ inputs.chart-path }}
132147
run: |
@@ -182,13 +197,6 @@ jobs:
182197
echo "⚠️ No GPG key provided, skipping import"
183198
fi
184199
185-
- name: Log in to primary registry
186-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
187-
with:
188-
registry: ${{ inputs.registry }}
189-
username: ${{ secrets.registry-username || github.actor }}
190-
password: ${{ secrets.registry-password || secrets.GITHUB_TOKEN }}
191-
192200
- name: Push chart to OCI registry
193201
id: push
194202
working-directory: /tmp/charts

0 commit comments

Comments
 (0)