Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release step in CI #2598

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,50 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ needs.checks.outputs.go_version }}
- name: Publish Release Notes on new tag
uses: release-drafter/release-drafter@v5

- uses: actions/setup-node@v3
- run: npm install js-yaml
continue-on-error: true
if: startsWith(github.ref, 'refs/tags/')
- name: Publish release on tag
uses: actions/github-script@v6
continue-on-error: true
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ startsWith(github.ref, 'refs/tags/') }}
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const ref = context.ref.split("/")[2]
const yaml = require('js-yaml');

const releases = (await github.rest.repos.listReleases({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
per_page: 100,
})).data

const draft_release = releases.find(release => release.draft && release.tag_name === ref)

const helm_file = (await github.rest.repos.getContent({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
path: "deployments/helm-chart/Chart.yaml",
ref: ref,
})).data.content

const helm_yaml = yaml.load(Buffer.from(helm_file, 'base64').toString())
const helm_version = helm_yaml.version
console.log(`Helm version: ${helm_version}`)

const update = await github.rest.repos.updateRelease({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
release_id: draft_release.id,
body: draft_release.body.replace("%HELM_CHART_VERSION%", helm_version),
draft: false
});
console.log(`Release published: ${update.data.html_url}`)
console.log(`Release notes: ${update.data.body}`)
if: startsWith(github.ref, 'refs/tags/')

- name: Build binaries
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
## Upgrade
- 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).
- 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.
- For Helm, use version HELM_VERSION_REPLACE_ME! of the chart.
- For Helm, use version %HELM_CHART_VERSION% of the chart.

## Resources
- Documentation -- https://docs.nginx.com/nginx-ingress-controller/
Expand Down