From fe2a7422706ca5136792b60e7acb93678db431af Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 1 Nov 2023 07:26:47 -0700 Subject: [PATCH] Move release script to GitHub Action (#4592) --- .github/workflows/release-pr.yml | 83 ++++++++++++++++++++++++++++++++ hack/prepare-release.sh | 66 ------------------------- 2 files changed, 83 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/release-pr.yml delete mode 100755 hack/prepare-release.sh diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 0000000000..d34e913b04 --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -0,0 +1,83 @@ +name: Release PR + +on: + workflow_dispatch: + inputs: + version: + description: "Version to release" + required: true + default: "0.0.0" + helm_version: + description: "Helm version to release" + required: true + default: "0.0.0" + +defaults: + run: + shell: bash + +jobs: + release: + runs-on: ubuntu-22.04 + 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ steps.branch.outputs.branch }} + token: ${{ secrets.NGINX_PAT }} + + - name: Replace + run: | + + DOCS_TO_UPDATE_FOLDER=docs/content + + FILES_TO_UPDATE_IC_VERSION=( + README.md + deployments/daemon-set/nginx-ingress.yaml + deployments/daemon-set/nginx-plus-ingress.yaml + deployments/deployment/nginx-ingress.yaml + deployments/deployment/nginx-plus-ingress.yaml + deployments/helm-chart/Chart.yaml + deployments/helm-chart/README.md + deployments/helm-chart/values-icp.yaml + deployments/helm-chart/values-nsm.yaml + deployments/helm-chart/values-plus.yaml + deployments/helm-chart/values.yaml + ) + + FILE_TO_UPDATE_HELM_CHART_VERSION=( + deployments/helm-chart/Chart.yaml + deployments/helm-chart/README.md + ) + + ic_version=${{ github.event.inputs.version }} + helm_chart_version=${{ github.event.inputs.helm_version }} + + current_ic_version=$(yq '.appVersion' + body: | + This automated PR updates the docs for ${{ github.event.inputs.version }} release. diff --git a/hack/prepare-release.sh b/hack/prepare-release.sh deleted file mode 100755 index d4141f9b29..0000000000 --- a/hack/prepare-release.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -# Updates the files required for a new release. Run this script in the release branch. -# -# Usage: -# hack/prepare-release.sh ic-version helm-chart-version -# -# Example: -# hack/prepare-release.sh 3.3.0 1.0.0 - -DOCS_TO_UPDATE_FOLDER=docs/content - -FILES_TO_UPDATE_IC_VERSION=( - README.md - deployments/daemon-set/nginx-ingress.yaml - deployments/daemon-set/nginx-plus-ingress.yaml - deployments/deployment/nginx-ingress.yaml - deployments/deployment/nginx-plus-ingress.yaml - charts/nginx-ingress/Chart.yaml - charts/nginx-ingress/README.md - charts/nginx-ingress/values-icp.yaml - charts/nginx-ingress/values-nsm.yaml - charts/nginx-ingress/values-plus.yaml - charts/nginx-ingress/values.yaml -) - -FILE_TO_UPDATE_HELM_CHART_VERSION=( - charts/nginx-ingress/Chart.yaml - charts/nginx-ingress/README.md -) - -if [ $# != 2 ]; then - echo "Invalid number of arguments" 1>&2 - echo "Usage: $0 ic-version helm-chart-version" 1>&2 - exit 1 -fi - -ic_version=$1 -helm_chart_version=$2 - -current_ic_version=$(yq '.appVersion' file2.new && mv file2.new docs/content/installation/installation-with-helm.md - -sed -i '' '/^|Parameter | Description | Default |/i\ -{{% table %}}\ -' docs/content/installation/installation-with-helm.md - -line_number=$(grep -n -e "|" docs/content/installation/installation-with-helm.md | tail -n 1 | cut -d : -f 1) - -sed -i '' "${line_number}a\\ -{{% /table %}} -" docs/content/installation/installation-with-helm.md