Release PR #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release PR | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to release" | |
required: true | |
default: "0.0.0" | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
release: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Branch | |
id: branch | |
run: | | |
version=${{ github.event.inputs.version }} | |
version=${version%.*} | |
echo "branch=release-$version" >> $GITHUB_OUTPUT | |
- name: Checkout Repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
ref: ${{ steps.branch.outputs.branch }} | |
- name: Get Release Notes | |
id: notes | |
uses: lucacome/draft-release@5d29432a46bff6c122cd4b07a1fb94e1bb158d34 # v1.1.1 | |
with: | |
config-path: .github/release-notes.yml | |
dry-run: true | |
- name: Vars | |
id: vars | |
run: | | |
# TODO(lucacome): improve this and maybe use appVersion instead of version if we switch to tags | |
echo "current_version=$(yq '.version' <charts/nginx-gateway-fabric/Chart.yaml)" >> $GITHUB_OUTPUT | |
- name: Find and Replace | |
uses: jacobtomlinson/gha-find-replace@099c88fbf2a7da26b083521a8bfa13e4f0886b97 # v3.0.3 | |
with: | |
find: ${{ steps.vars.outputs.current_version }} | |
replace: ${{ inputs.version }} | |
include: "site/content/**/*.md" | |
regex: false | |
- name: Find and Replace | |
uses: jacobtomlinson/gha-find-replace@099c88fbf2a7da26b083521a8bfa13e4f0886b97 # v3.0.3 | |
with: | |
find: "edge" | |
replace: ${{ inputs.version }} | |
include: "charts/nginx-gateway-fabric/*.yaml" | |
regex: false | |
- name: Find and Replace | |
uses: jacobtomlinson/gha-find-replace@099c88fbf2a7da26b083521a8bfa13e4f0886b97 # v3.0.3 | |
with: | |
find: ${{ steps.vars.outputs.current_version }} | |
replace: ${{ inputs.version }} | |
include: "charts/nginx-gateway-fabric/*.yaml" | |
regex: false | |
- name: Find and Replace | |
uses: jacobtomlinson/gha-find-replace@099c88fbf2a7da26b083521a8bfa13e4f0886b97 # v3.0.3 | |
with: | |
find: "Always" | |
replace: "IfNotPresent" | |
include: "charts/nginx-gateway-fabric/*.yaml" | |
regex: false | |
- name: Generate files and changelog | |
run: | | |
sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md | |
sed -i -e "s/\[${{ steps.vars.outputs.current_version }}\]/\[${{ inputs.version }}\]/g" README.md | |
sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile | |
sed -i "6r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md | |
sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md | |
sed -i "8a ${{ join(fromJson(steps.notes.outputs.release-sections).release-notes, '\n') }}\n" CHANGELOG.md | |
make generate-all | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 | |
with: | |
token: ${{ secrets.NGINX_PAT }} | |
commit-message: Release ${{ inputs.version }} | |
title: Release ${{ inputs.version }} | |
draft: true | |
delete-branch: true | |
branch: docs/release-${{ inputs.version }} | |
author: nginx-bot <[email protected]> | |
committer: nginx-bot <[email protected]> | |
body: | | |
This automated PR updates all the necessary files for ${{ inputs.version }} release. |