Skip to content

Commit fc5f900

Browse files
committed
feat(ci): enhance GitHub Actions pipeline for artifact management
- Refines Helm chart repository configuration by separating protocol for clarity and flexibility. - Updates output result handling during evaluation to ensure accurate success/failure reporting. - Integrates additional steps for downloading helm and kubectl artifacts. - Reinstates tools installation steps for ORAS and includes login to GitHub Container Registry. - Implements pushing Helm chart metadata to the artifact hub in accordance with the new repository protocol.
1 parent 09fb9f6 commit fc5f900

File tree

1 file changed

+51
-43
lines changed

1 file changed

+51
-43
lines changed

.github/workflows/pipeline.yaml

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ concurrency:
2626
env:
2727
helm_chart: "reflector"
2828
helm_chart_dir: "src/helm/reflector"
29-
helm_chart_repository: "oci://ghcr.io/emberstack/helm-charts"
29+
helm_chart_repository: "ghcr.io/emberstack/helm-charts"
30+
helm_chart_repository_protocol: "oci://"
3031

3132
container_image: "kubernetes-reflector"
3233
container_image_build_context: "."
@@ -102,7 +103,7 @@ jobs:
102103
else
103104
result=false
104105
fi
105-
echo "result=true" >> $GITHUB_OUTPUT
106+
echo "result=$result" >> $GITHUB_OUTPUT
106107
107108
- name: evaluate - build_push
108109
id: evaluate_build_push
@@ -178,16 +179,6 @@ jobs:
178179
reporter: dotnet-trx
179180
fail-on-empty: "false"
180181

181-
# - name: tools - kubectl - install
182-
# uses: azure/setup-kubectl@v4
183-
184-
# - name: tools - oras - install
185-
# uses: oras-project/setup-oras@v1
186-
187-
# - name: tools - oras - login - ghcr.io
188-
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
189-
# run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
190-
191182
- name: tools - helm - install
192183
uses: azure/setup-helm@v4
193184

@@ -252,7 +243,7 @@ jobs:
252243
253244
- name: helm - push
254245
if: ${{ env.build_push == 'true' }}
255-
run: helm push .artifacts/helm/${{ env.helm_chart }}-${{ env.gitVersion_SemVer }}.tgz ${{ env.helm_chart_repository }}
246+
run: helm push .artifacts/helm/${{ env.helm_chart }}-${{ env.gitVersion_SemVer }}.tgz ${{ env.helm_chart_repository_protocol }}${{ env.helm_chart_repository }}
256247

257248
- name: artifacts - helm - upload
258249
uses: actions/upload-artifact@v4
@@ -272,36 +263,53 @@ jobs:
272263
needs: [discovery, build]
273264
runs-on: ubuntu-latest
274265
env:
275-
release: ${{ needs.discovery.outputs.release }}
276266
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
277267
gitVersion_AssemblySemFileVer: ${{ needs.discovery.outputs.gitVersion_AssemblySemFileVer }}
278268
steps:
279-
- name: checkout
280-
uses: actions/checkout@v4
281-
# - name: oras - push - artifact hub metadata
282-
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
283-
# run: |
284-
# oras push ghcr.io/${{ github.repository_owner }}/helm-charts/${{ env.helmChart }}:artifacthub.io \
285-
# --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
286-
# .artifacts/artifacthub/artifacthub-repo.yaml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
287-
288-
# - name: docker - tag and push - latest
289-
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
290-
# run: |
291-
# docker buildx imagetools create \
292-
# --tag ${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:latest \
293-
# --tag ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:latest \
294-
# ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
295-
296-
# - name: github - release - create
297-
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
298-
# uses: softprops/action-gh-release@v2
299-
# with:
300-
# repository: ${{ github.repository }}
301-
# name: v${{ env.gitVersion_SemVer }}
302-
# tag_name: v${{ env.gitVersion_SemVer }}
303-
# body: The release process is automated.
304-
# generate_release_notes: true
305-
# token: ${{ secrets.ES_GITHUB_PAT }}
306-
# files: |
307-
# .artifacts/kubectl/${{ env.helmChart }}.yaml
269+
270+
- name: artifacts - helm - download
271+
uses: actions/download-artifact@v4
272+
with:
273+
name: artifacts-helm-${{env.gitVersion_SemVer}}
274+
path: .artifacts/helm
275+
276+
- name: artifacts - kubectl - download
277+
uses: actions/download-artifact@v4
278+
with:
279+
name: artifacts-kubectl-${{env.gitVersion_SemVer}}
280+
path: .artifacts/kubectl
281+
282+
- name: tools - oras - install
283+
uses: oras-project/setup-oras@v1
284+
285+
- name: tools - oras - login - ghcr.io
286+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
287+
288+
289+
- name: oras - push - helm - artifact hub metadata
290+
if: ${{ env.helm_chart_repository_protocol == 'oci://' }}
291+
run: |
292+
oras push ${{ env.helm_chart_repository }}/${{ env.helm_chart }}:artifacthub.io \
293+
--config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
294+
.artifacts/helm/artifacthub-repo.yaml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
295+
296+
- name: docker - tag and push - latest
297+
run: |
298+
docker buildx imagetools create \
299+
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:latest \
300+
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:latest \
301+
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
302+
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
303+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}
304+
305+
- name: github - release - create
306+
uses: softprops/action-gh-release@v2
307+
with:
308+
repository: ${{ github.repository }}
309+
name: v${{ env.gitVersion_SemVer }}
310+
tag_name: v${{ env.gitVersion_SemVer }}
311+
body: The release process is automated.
312+
generate_release_notes: true
313+
token: ${{ secrets.ES_GITHUB_PAT }}
314+
files: |
315+
.artifacts/kubectl/${{ env.helmChart }}.yaml

0 commit comments

Comments
 (0)