Skip to content

Commit 0ab60d6

Browse files
authored
Update release step in CI (#2598)
1 parent 4ca3b91 commit 0ab60d6

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,50 @@ jobs:
279279
uses: actions/setup-go@v3
280280
with:
281281
go-version: ${{ needs.checks.outputs.go_version }}
282-
- name: Publish Release Notes on new tag
283-
uses: release-drafter/release-drafter@v5
282+
283+
- uses: actions/setup-node@v3
284+
- run: npm install js-yaml
285+
continue-on-error: true
286+
if: startsWith(github.ref, 'refs/tags/')
287+
- name: Publish release on tag
288+
uses: actions/github-script@v6
289+
continue-on-error: true
284290
with:
285-
publish: true
286-
env:
287-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
291+
github-token: ${{secrets.GITHUB_TOKEN}}
292+
script: |
293+
const ref = context.ref.split("/")[2]
294+
const yaml = require('js-yaml');
295+
296+
const releases = (await github.rest.repos.listReleases({
297+
owner: context.payload.repository.owner.login,
298+
repo: context.payload.repository.name,
299+
per_page: 100,
300+
})).data
301+
302+
const draft_release = releases.find(release => release.draft && release.tag_name === ref)
303+
304+
const helm_file = (await github.rest.repos.getContent({
305+
owner: context.payload.repository.owner.login,
306+
repo: context.payload.repository.name,
307+
path: "deployments/helm-chart/Chart.yaml",
308+
ref: ref,
309+
})).data.content
310+
311+
const helm_yaml = yaml.load(Buffer.from(helm_file, 'base64').toString())
312+
const helm_version = helm_yaml.version
313+
console.log(`Helm version: ${helm_version}`)
314+
315+
const update = await github.rest.repos.updateRelease({
316+
owner: context.payload.repository.owner.login,
317+
repo: context.payload.repository.name,
318+
release_id: draft_release.id,
319+
body: draft_release.body.replace("%HELM_CHART_VERSION%", helm_version),
320+
draft: false
321+
});
322+
console.log(`Release published: ${update.data.html_url}`)
323+
console.log(`Release notes: ${update.data.body}`)
324+
if: startsWith(github.ref, 'refs/tags/')
325+
289326
- name: Build binaries
290327
uses: goreleaser/goreleaser-action@v2
291328
with:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
## Upgrade
9292
- For NGINX, use the v${version} image from our [DockerHub](https://hub.docker.com/r/nginx/nginx-ingress/tags?page=1&ordering=last_updated&name=${version}), [GitHub Container](https://github.com/nginxinc/kubernetes-ingress/pkgs/container/kubernetes-ingress) or [Amazon ECR Public Gallery](https://gallery.ecr.aws/nginx/nginx-ingress).
9393
- For NGINX Plus, use the v${version} image from the F5 Container registry or the [AWS Marketplace](https://aws.amazon.com/marketplace/search/?CREATOR=741df81b-dfdc-4d36-b8da-945ea66b522c&FULFILLMENT_OPTION_TYPE=CONTAINER&filters=CREATOR%2CFULFILLMENT_OPTION_TYPE) or build your own image using the v${version} source code.
94-
- For Helm, use version HELM_VERSION_REPLACE_ME! of the chart.
94+
- For Helm, use version %HELM_CHART_VERSION% of the chart.
9595
9696
## Resources
9797
- Documentation -- https://docs.nginx.com/nginx-ingress-controller/

0 commit comments

Comments
 (0)