Skip to content

Commit bdac8c9

Browse files
authored
Dry-run push-chart & push-image workflows on push (#14)
1 parent 696ec3b commit bdac8c9

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/push-chart.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: push-chart
22

33
on:
44
push:
5+
branches:
6+
- '**'
57
tags:
68
- v*
79

@@ -23,6 +25,7 @@ jobs:
2325
uses: azure/setup-helm@v4.3.1
2426

2527
- name: Log in to the Container registry
28+
if: startsWith(github.ref, 'refs/tags/v')
2629
uses: docker/login-action@v2
2730
with:
2831
registry: ${{ env.REGISTRY }}
@@ -32,17 +35,28 @@ jobs:
3235
- name: Extract version from tag
3336
id: get_version
3437
run: |
35-
VERSION=${GITHUB_REF#refs/tags/v}
36-
echo "version=$VERSION" >> $GITHUB_OUTPUT
37-
echo "Chart version: $VERSION"
38-
39-
- name: Update Chart.yaml with version
38+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
39+
VERSION=${GITHUB_REF#refs/tags/v}
40+
echo "version=$VERSION" >> $GITHUB_OUTPUT
41+
echo "Chart version: $VERSION"
42+
else
43+
echo "Not a tag push, skipping version extraction"
44+
echo "version=0.0.0-dev" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Set chart version
4048
run: |
4149
sed -i "s/^version:.*/version: ${{ steps.get_version.outputs.version }}/" ./chart/Chart.yaml
4250
sed -i "s/^appVersion:.*/appVersion: \"${{ steps.get_version.outputs.version }}\"/" ./chart/Chart.yaml
4351
cat ./chart/Chart.yaml
52+
helm template --debug ./chart
53+
54+
- name: Lint
55+
run: |
56+
helm lint chart
4457
45-
- name: Publish Helm chart to GHCR
58+
- name: Publish chart to registry
59+
if: startsWith(github.ref, 'refs/tags/v')
4660
run: |
4761
helm package chart
4862
helm push domaineer-${{ steps.get_version.outputs.version }}.tgz oci://${{ env.REGISTRY }}/gldraphael/charts

.github/workflows/push-image.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: push-image
22

33
on:
44
push:
5+
branches:
6+
- '**'
57
tags:
68
- v*
79

@@ -23,6 +25,7 @@ jobs:
2325
uses: actions/checkout@v5
2426

2527
- name: Log in to the Container registry
28+
if: startsWith(github.ref, 'refs/tags/v')
2629
uses: docker/login-action@v2
2730
with:
2831
registry: ${{ env.REGISTRY }}
@@ -40,6 +43,6 @@ jobs:
4043
with:
4144
context: ${{ env.CONTEXT }}
4245
file: ${{ env.DOCKERFILE }}
43-
push: true
46+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
4447
tags: ${{ steps.meta.outputs.tags }}
4548
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)