1- name : Release – Build Images & Publish Helm Charts to GHCR
1+ name : publish release # Publish a release's container images and Helm chart
22
33on :
44 release :
99 description : ' Release tag (e.g., v0.3.1) - for testing without creating a release'
1010 required : true
1111 type : string
12- push :
13- tags :
14- - ' v*'
1512
1613permissions :
1714 contents : read
@@ -26,26 +23,20 @@ jobs:
2623 # 1. Checkout repo
2724 # -----------------------------------------
2825 - name : Checkout
29- uses : actions/checkout@v4
26+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3027 with :
31- ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }}
28+ ref : ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.tag) || github.ref }}
3229 token : ${{ github.token }}
3330 persist-credentials : true
3431
3532 # -----------------------------------------
36- # 2. Determine version from tag (v0.3.1 → 0.3.1)
33+ # 2. Determine version from tag
3734 # -----------------------------------------
3835 - name : Determine version from tag
3936 id : version
4037 run : |
4138 if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
4239 RAW_TAG="${{ github.event.inputs.tag }}"
43- if [[ -z "$RAW_TAG" ]]; then
44- echo "Error: tag input required for workflow_dispatch" >&2
45- exit 1
46- fi
47- elif [[ "${{ github.event_name }}" == "push" ]]; then
48- RAW_TAG="${GITHUB_REF#refs/tags/}"
4940 else
5041 RAW_TAG="${GITHUB_REF#refs/tags/}"
5142 fi
@@ -57,114 +48,104 @@ jobs:
5748 # 3. Set up build tools
5849 # -----------------------------------------
5950 - name : Install ko
60- uses : ko-build/setup-ko@v0.7
51+ uses : ko-build/setup-ko@3aebd0597dc1e9d1a26bcfdb7cbeb19c131d3037 # v0.7
6152
6253 - name : Set up Docker Buildx
63- uses : docker/setup-buildx-action@v3
54+ uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
6455
6556 - name : Set up QEMU
66- uses : docker/setup-qemu-action@v3
57+ uses : docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
6758
6859 # -----------------------------------------
6960 # 4. Log in to GHCR
7061 # -----------------------------------------
7162 - name : Log in to GitHub Container Registry
72- uses : docker/login-action@v3
63+ uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
7364 with :
7465 registry : ghcr.io
7566 username : ${{ github.actor }}
7667 password : ${{ secrets.GITHUB_TOKEN }}
7768
7869 # -----------------------------------------
79- # 5. Build and push controller image
70+ # 5. Build and push dual-pods controller image
8071 # -----------------------------------------
81- - name : Build and push controller image
72+ - name : Build and push dual-pods controller image
8273 run : |
8374 TAG="${{ steps.version.outputs.tag }}"
75+ reg="${{ github.repository }}"
8476
77+ KO_DOCKER_REPO=ghcr.io/${reg@L} \
8578 make build-controller \
86- CONTAINER_IMG_REG=ghcr.io/${{ github.repository } } \
79+ CONTAINER_IMG_REG=ghcr.io/${reg@L } \
8780 CONTROLLER_IMG_TAG=$TAG
8881
89- echo "Controller image published: ghcr.io/${{ github.repository } }/dual-pods-controller:$TAG"
82+ echo "Dual-pods controller image published: ghcr.io/${reg@L }/dual-pods-controller:$TAG"
9083
9184 # -----------------------------------------
92- # 6. Build and push populator image
85+ # 6. Build and push launcher population controller image
9386 # -----------------------------------------
94- - name : Build and push populator image
87+ - name : Build and push launcher population controller image
9588 run : |
9689 TAG="${{ steps.version.outputs.tag }}"
90+ reg="${{ github.repository }}"
9791
92+ KO_DOCKER_REPO=ghcr.io/${reg@L} \
9893 make build-populator \
99- CONTAINER_IMG_REG=ghcr.io/${{ github.repository } } \
94+ CONTAINER_IMG_REG=ghcr.io/${reg@L } \
10095 POPULATOR_IMG_TAG=$TAG
10196
102- echo "Populator image published: ghcr.io/${{ github.repository } }/launcher-populator:$TAG"
97+ echo "Launcher population controller image published: ghcr.io/${reg@L }/launcher-populator:$TAG"
10398
10499 # -----------------------------------------
105- # 7. Build and push launcher image
100+ # 7. Build and push requester image
106101 # -----------------------------------------
107- - name : Build and push launcher image
102+ - name : Build and push requester image
108103 run : |
109104 TAG="${{ steps.version.outputs.tag }}"
105+ reg="${{ github.repository }}"
110106
111- make build-and-push-launcher \
112- CONTAINER_IMG_REG=ghcr.io/${{ github.repository } } \
113- LAUNCHER_IMG_TAG =$TAG
107+ make build-and-push-requester \
108+ CONTAINER_IMG_REG=ghcr.io/${reg@L } \
109+ REQUESTER_IMG_TAG =$TAG
114110
115- echo "Launcher image published: ghcr.io/${{ github.repository }}/launcher :$TAG"
111+ echo "Requester image published: ghcr.io/${reg@L}/requester :$TAG"
116112
117113 # -----------------------------------------
118- # 8. Build and push requester image
114+ # 8. Build and push launcher image
119115 # -----------------------------------------
120- - name : Build and push requester image
116+ - name : Build and push launcher image
121117 run : |
122118 TAG="${{ steps.version.outputs.tag }}"
119+ reg="${{ github.repository }}"
123120
124- make build-and-push-requester \
125- CONTAINER_IMG_REG=ghcr.io/${{ github.repository }} \
126- REQUESTER_IMG_TAG=$TAG
127-
128- echo "Requester image published: ghcr.io/${{ github.repository }}/requester:$TAG"
121+ make build-and-push-launcher \
122+ CONTAINER_IMG_REG=ghcr.io/${reg@L} \
123+ LAUNCHER_IMG_TAG=$TAG
129124
130- # -----------------------------------------
131- # 9. Install Helm
132- # -----------------------------------------
133- - name : Install Helm
134- uses : azure/setup-helm@v4
135- with :
136- version : ' v3.16.3'
125+ echo "Launcher image published: ghcr.io/${reg@L}/launcher:$TAG"
137126
138127 # -----------------------------------------
139- # 9. Update Helm charts with release version
128+ # 9. Update Helm chart values with release images
140129 # -----------------------------------------
141- - name : Update Helm chart files with version
130+ - name : Update Helm chart values with release images
142131 run : |
143- VERSION="${{ steps.version.outputs.version }}"
144132 TAG="${{ steps.version.outputs.tag }}"
133+ reg="${{ github.repository }}"
145134
146- # Update dpctlr chart
147- DPCTLR_CHART="charts/dpctlr"
148- sed -i "s/^version:.*/version: ${VERSION}/" $DPCTLR_CHART/Chart.yaml
149- sed -i "s/^appVersion:.*/appVersion: \"${TAG}\"/" $DPCTLR_CHART/Chart.yaml
150- sed -i "s|Image:.*|Image: ghcr.io/${{ github.repository }}/dual-pods-controller:${TAG}|" $DPCTLR_CHART/values.yaml
135+ # Update dual-pods-controller chart values
136+ DPCTLR_CHART="charts/dual-pods-controller"
137+ yq eval -i ".Image = \"ghcr.io/${reg@L}/dual-pods-controller:${TAG}\"" $DPCTLR_CHART/values.yaml
151138
152- echo "Updated $DPCTLR_CHART/Chart.yaml:"
153- grep -E '^(version|appVersion):' $DPCTLR_CHART/Chart.yaml
154139 echo "Updated $DPCTLR_CHART/values.yaml:"
155- grep '^ Image: ' $DPCTLR_CHART/values.yaml
140+ yq eval '. Image' $DPCTLR_CHART/values.yaml
156141
157- # Update launcher-populator chart
142+ # Update launcher-populator chart values
158143 POPULATOR_CHART="charts/launcher-populator"
159- sed -i "s/^version:.*/version: ${VERSION}/" $POPULATOR_CHART/Chart.yaml
160- sed -i "s/^appVersion:.*/appVersion: \"${TAG}\"/" $POPULATOR_CHART/Chart.yaml
161- sed -i "s|repository:.*|repository: ghcr.io/${{ github.repository }}/launcher-populator|" $POPULATOR_CHART/values.yaml
162- sed -i "s/tag:.*/tag: ${TAG}/" $POPULATOR_CHART/values.yaml
144+ yq eval -i ".image.repository = \"ghcr.io/${reg@L}/launcher-populator\"" $POPULATOR_CHART/values.yaml
145+ yq eval -i ".image.tag = \"${TAG}\"" $POPULATOR_CHART/values.yaml
163146
164- echo "Updated $POPULATOR_CHART/Chart.yaml:"
165- grep -E '^(version|appVersion):' $POPULATOR_CHART/Chart.yaml
166147 echo "Updated $POPULATOR_CHART/values.yaml:"
167- grep -E '(repository|tag): ' $POPULATOR_CHART/values.yaml
148+ yq eval '.image ' $POPULATOR_CHART/values.yaml
168149
169150 # -----------------------------------------
170151 # 10. Login to GHCR for Helm
@@ -180,17 +161,23 @@ jobs:
180161 # -----------------------------------------
181162 - name : Package and push Helm charts
182163 run : |
164+ VERSION="${{ steps.version.outputs.version }}"
165+ TAG="${{ steps.version.outputs.tag }}"
166+ reg="${{ github.repository }}"
167+
183168 for DIR in charts/*/; do
184- CHART_NAME=$(helm show chart "$DIR" | grep '^name:' | awk '{print $2}')
185- CHART_VERSION=$(helm show chart "$DIR" | grep '^version:' | awk '{print $2}')
169+ CHART_NAME=$(basename "$DIR")
186170
187- echo "Packaging $CHART_NAME version $CHART_VERSION..."
188- helm package "$DIR" --destination .
171+ echo "Packaging $CHART_NAME with version $VERSION and appVersion $TAG..."
172+ helm package "$DIR" \
173+ --version "$VERSION" \
174+ --app-version "$TAG" \
175+ --destination .
189176
190- echo "Pushing $CHART_NAME-$CHART_VERSION .tgz to GHCR..."
191- helm push "$CHART_NAME-$CHART_VERSION .tgz" oci://ghcr.io/${{ github.repository } }/charts
177+ echo "Pushing $CHART_NAME-$VERSION .tgz to GHCR..."
178+ helm push "$CHART_NAME-$VERSION .tgz" oci://ghcr.io/${reg@L }/charts
192179
193- echo "✓ Published $CHART_NAME:$CHART_VERSION "
180+ echo "✓ Published $CHART_NAME:$VERSION (appVersion: $TAG) "
194181 done
195182
196183 # -----------------------------------------
@@ -200,22 +187,23 @@ jobs:
200187 run : |
201188 TAG="${{ steps.version.outputs.tag }}"
202189 VERSION="${{ steps.version.outputs.version }}"
190+ reg="${{ github.repository }}"
203191
204192 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
205193 echo "Release $TAG completed successfully!"
206194 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
207195 echo ""
208196 echo "Container Images:"
209- echo " • ghcr.io/${{ github.repository } }/dual-pods-controller:$TAG"
210- echo " • ghcr.io/${{ github.repository } }/launcher-populator:$TAG"
211- echo " • ghcr.io/${{ github.repository } }/launcher:$TAG"
212- echo " • ghcr.io/${{ github.repository } }/requester:$TAG"
197+ echo " • ghcr.io/${reg@L }/dual-pods-controller:$TAG"
198+ echo " • ghcr.io/${reg@L }/launcher-populator:$TAG"
199+ echo " • ghcr.io/${reg@L }/launcher:$TAG"
200+ echo " • ghcr.io/${reg@L }/requester:$TAG"
213201 echo ""
214202 echo "Helm Charts (version $VERSION):"
215- echo " • oci://ghcr.io/${{ github.repository } }/charts/dual-pods-controller"
216- echo " • oci://ghcr.io/${{ github.repository } }/charts/launcher-populator"
203+ echo " • oci://ghcr.io/${reg@L }/charts/dual-pods-controller"
204+ echo " • oci://ghcr.io/${reg@L }/charts/launcher-populator"
217205 echo ""
218206 echo "Install with:"
219- echo " helm install dpctlr oci://ghcr.io/${{ github.repository } }/charts/dual-pods-controller --version $VERSION"
220- echo " helm install launcher-populator oci://ghcr.io/${{ github.repository } }/charts/launcher-populator --version $VERSION"
207+ echo " helm install dpctlr oci://ghcr.io/${reg@L }/charts/dual-pods-controller --version $VERSION"
208+ echo " helm install launcher-populator oci://ghcr.io/${reg@L }/charts/launcher-populator --version $VERSION"
221209 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
0 commit comments