From 63eca8d5dfacf552464f9b17ee7d3ee9f56b5501 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Fri, 1 Nov 2024 14:52:17 -0300 Subject: [PATCH 1/7] build: add create release proposal action --- .github/workflows/create-release-proposal.yml | 75 +++++++++++++++++++ tools/actions/create-release.sh | 15 ++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/create-release-proposal.yml create mode 100755 tools/actions/create-release.sh diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml new file mode 100644 index 00000000000000..0a10d47048d081 --- /dev/null +++ b/.github/workflows/create-release-proposal.yml @@ -0,0 +1,75 @@ +# This action requires the following secrets to be set on the repository: +# GH_USER_NAME: GitHub user whose Jenkins and GitHub token are defined below +# GH_USER_TOKEN: GitHub user token, to be used by ncu and to push changes +# JENKINS_TOKEN: Jenkins token, to be used to check CI status + +name: Create Release Proposal + +on: + workflow_dispatch: + inputs: + release-line: + required: true + type: number + default: 23 + description: 'The release line (without dots or prefix). e.g: 22/20/18' + release-date: + required: true + type: string + default: 'YYYY-MM-DD' + description: 'The release date in YYYY-MM-DD format' + +concurrency: ${{ github.workflow }} + +env: + NODE_VERSION: lts/* + +permissions: + contents: read + +jobs: + env: + STAGING_BRANCH: v${{ inputs.release-line }}.x-staging + RELEASE_BRANCH: v${{ inputs.release-line }}.x + RELEASE_DATE: ${{ inputs.release-date }} + releasePrepare: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + branch: ${{ env.STAGING_BRANCH }} + # Needs the whole git history for ncu to work + # See https://github.com/nodejs/node-core-utils/pull/486 + fetch-depth: 0 + token: ${{ secrets.GH_USER_TOKEN }} + + # Install dependencies + - name: Install Node.js + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install @node-core/utils + run: npm install -g @node-core/utils + + - name: Set variables + run: | + echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV + echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV + + - name: Configure @node-core/utils + run: | + ncu-config set branch ${{ env.RELEASE_BRANCH }} + ncu-config set upstream origin + ncu-config set username "$USERNAME" + ncu-config set token "$GH_TOKEN" + ncu-config set jenkins_token "$JENKINS_TOKEN" + ncu-config set repo "${REPOSITORY}" + ncu-config set owner "${OWNER}" + env: + USERNAME: ${{ secrets.JENKINS_USER }} + GH_TOKEN: ${{ secrets.GH_USER_TOKEN }} + JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }} + + - name: Start git node release prepare + run: ./tools/actions/create-release.sh ${{ inputs.RELEASE_DATE }} diff --git a/tools/actions/create-release.sh b/tools/actions/create-release.sh new file mode 100755 index 00000000000000..a39cf24dc4e81d --- /dev/null +++ b/tools/actions/create-release.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -xe + +RELEASE_DATE=$1 + +git node release --prepare --skipBranchDiff +# We use it to not specify the branch name as it changes based on +# the commit list (semver-minor/semver-patch) +git config push.default current +git push upstream +echo "/## $RELEASE_DATE/,/^ temp.awk +awk -f temp.awk doc/changelogs/CHANGELOG_V23.md > pr-body.md +gh pr create --body-file pr-body.md +# TODO: ammend with proposal PR From b6664a2b94f8c893754f014eaefbf76c8c74949b Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Sat, 2 Nov 2024 01:13:18 -0300 Subject: [PATCH 2/7] fixup! build: add create release proposal action --- .github/workflows/create-release-proposal.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index 0a10d47048d081..1aace5e1a21b22 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -16,8 +16,8 @@ on: release-date: required: true type: string - default: 'YYYY-MM-DD' - description: 'The release date in YYYY-MM-DD format' + default: YYYY-MM-DD + description: The release date in YYYY-MM-DD format concurrency: ${{ github.workflow }} From d2b862451cb7f63563c7466c8373ede74d25b354 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Tue, 5 Nov 2024 17:12:28 -0300 Subject: [PATCH 3/7] fixup! fixup! build: add create release proposal action --- .github/workflows/create-release-proposal.yml | 6 +++--- tools/actions/create-release.sh | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index 1aace5e1a21b22..afb82ed89a3a6d 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -41,7 +41,6 @@ jobs: # Needs the whole git history for ncu to work # See https://github.com/nodejs/node-core-utils/pull/486 fetch-depth: 0 - token: ${{ secrets.GH_USER_TOKEN }} # Install dependencies - name: Install Node.js @@ -59,7 +58,7 @@ jobs: - name: Configure @node-core/utils run: | - ncu-config set branch ${{ env.RELEASE_BRANCH }} + ncu-config set branch "${RELEASE_BRANCH}" ncu-config set upstream origin ncu-config set username "$USERNAME" ncu-config set token "$GH_TOKEN" @@ -72,4 +71,5 @@ jobs: JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }} - name: Start git node release prepare - run: ./tools/actions/create-release.sh ${{ inputs.RELEASE_DATE }} + run: | + ./tools/actions/create-release.sh "${RELEASE_DATE}" diff --git a/tools/actions/create-release.sh b/tools/actions/create-release.sh index a39cf24dc4e81d..21907b1217bb11 100755 --- a/tools/actions/create-release.sh +++ b/tools/actions/create-release.sh @@ -8,7 +8,6 @@ git node release --prepare --skipBranchDiff # We use it to not specify the branch name as it changes based on # the commit list (semver-minor/semver-patch) git config push.default current -git push upstream echo "/## $RELEASE_DATE/,/^ temp.awk awk -f temp.awk doc/changelogs/CHANGELOG_V23.md > pr-body.md gh pr create --body-file pr-body.md From 66bd1297d38406994e6cc72832238d2a3aba5b5b Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Tue, 12 Nov 2024 16:52:55 -0300 Subject: [PATCH 4/7] Update .github/workflows/create-release-proposal.yml Co-authored-by: Ruy Adorno --- .github/workflows/create-release-proposal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index afb82ed89a3a6d..851c46b37975a0 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -12,7 +12,7 @@ on: required: true type: number default: 23 - description: 'The release line (without dots or prefix). e.g: 22/20/18' + description: 'The release line (without dots or prefix). e.g: 22' release-date: required: true type: string From 29ccc97f81cb295c47ae1278772b960af8ec169e Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Wed, 13 Nov 2024 10:07:25 -0300 Subject: [PATCH 5/7] fixup! fixup! fixup! build: add create release proposal action --- .github/workflows/create-release-proposal.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index 851c46b37975a0..97f3227c4caefd 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -28,11 +28,11 @@ permissions: contents: read jobs: - env: - STAGING_BRANCH: v${{ inputs.release-line }}.x-staging - RELEASE_BRANCH: v${{ inputs.release-line }}.x - RELEASE_DATE: ${{ inputs.release-date }} releasePrepare: + env: + STAGING_BRANCH: v${{ inputs.release-line }}.x-staging + RELEASE_BRANCH: v${{ inputs.release-line }}.x + RELEASE_DATE: ${{ inputs.release-date }} runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 From 23fe5965b3de341a0f46dd7faf8b53e06d54e417 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Wed, 13 Nov 2024 18:47:21 -0300 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Antoine du Hamel Co-authored-by: Aviv Keller --- .github/workflows/create-release-proposal.yml | 9 ++------- tools/actions/create-release.sh | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index 97f3227c4caefd..13ea3bddad4ea1 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -51,11 +51,6 @@ jobs: - name: Install @node-core/utils run: npm install -g @node-core/utils - - name: Set variables - run: | - echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV - echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV - - name: Configure @node-core/utils run: | ncu-config set branch "${RELEASE_BRANCH}" @@ -63,8 +58,8 @@ jobs: ncu-config set username "$USERNAME" ncu-config set token "$GH_TOKEN" ncu-config set jenkins_token "$JENKINS_TOKEN" - ncu-config set repo "${REPOSITORY}" - ncu-config set owner "${OWNER}" + ncu-config set repo "$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)" + ncu-config set owner "${GITHUB_REPOSITORY_OWNER}" env: USERNAME: ${{ secrets.JENKINS_USER }} GH_TOKEN: ${{ secrets.GH_USER_TOKEN }} diff --git a/tools/actions/create-release.sh b/tools/actions/create-release.sh index 21907b1217bb11..bca44e0e9f1f33 100755 --- a/tools/actions/create-release.sh +++ b/tools/actions/create-release.sh @@ -8,7 +8,7 @@ git node release --prepare --skipBranchDiff # We use it to not specify the branch name as it changes based on # the commit list (semver-minor/semver-patch) git config push.default current -echo "/## $RELEASE_DATE/,/^ temp.awk -awk -f temp.awk doc/changelogs/CHANGELOG_V23.md > pr-body.md +MATCHER="/## $RELEASE_DATE/,/^ pr-body.md gh pr create --body-file pr-body.md # TODO: ammend with proposal PR From 452c3c2c1d8459447030998119423e35e2ea02a4 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Wed, 13 Nov 2024 21:40:37 -0300 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Antoine du Hamel --- .github/workflows/create-release-proposal.yml | 2 +- tools/actions/create-release.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml index 13ea3bddad4ea1..4084e75666ae6a 100644 --- a/.github/workflows/create-release-proposal.yml +++ b/.github/workflows/create-release-proposal.yml @@ -67,4 +67,4 @@ jobs: - name: Start git node release prepare run: | - ./tools/actions/create-release.sh "${RELEASE_DATE}" + ./tools/actions/create-release.sh "${RELEASE_DATE}" '${{ inputs.release-line }}' diff --git a/tools/actions/create-release.sh b/tools/actions/create-release.sh index bca44e0e9f1f33..1f17ba489cd6f0 100755 --- a/tools/actions/create-release.sh +++ b/tools/actions/create-release.sh @@ -3,12 +3,13 @@ set -xe RELEASE_DATE=$1 +RELEASE_LINE=$2 git node release --prepare --skipBranchDiff # We use it to not specify the branch name as it changes based on # the commit list (semver-minor/semver-patch) git config push.default current -MATCHER="/## $RELEASE_DATE/,/^ pr-body.md -gh pr create --body-file pr-body.md +awk "/## ${RELEASE_DATE}/,/^