From 16f476397776c5acca30f0f7512b4390c134a681 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Mon, 9 Dec 2024 15:12:57 -0300 Subject: [PATCH 1/7] build: add major release action This action reminds collaborators of the upcoming major release date. In the future, this action can also update and create the branches (that's why the action name is generic). --- .github/workflows/major-release.yml | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/major-release.yml diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml new file mode 100644 index 00000000000000..27fdcd57fc41ff --- /dev/null +++ b/.github/workflows/major-release.yml @@ -0,0 +1,51 @@ +name: Major Release + +permissions: + issues: write + contents: write + +on: + schedule: + - cron: '0 0 15 * *' + +jobs: + create-issue: + runs-on: ubuntu-latest + + steps: + - name: Check for release schedule + id: check-date + run: | + # Get the current month and day + MONTH=$(date +'%m') + DAY=$(date +'%d') + # We'll create the reminder issue two months prior the release + if [[ "$MONTH" == "02" || "$MONTH" == "08" ]] && [[ "$DAY" == "15" ]]; then + echo "create_issue=true" >> $GITHUB_ENV + release_date=$(date -d "$(date +%Y-%m-%d) +2 month" +"%d %B %Y") + echo "RELEASE_DATE=$release_date" >> $GITHUB_ENV + pr_max_date=$(date -d "$(date +%Y-%m-%d) +1 month" +"%d %B %Y") + echo "PR_MAX_DATE=$pr_max_date" >> $GITHUB_ENV + else + echo "create_issue=false" >> $GITHUB_ENV + fi + - name: Create release announcement issue + if: env.create_issue == 'true' + run: | + cat < body.json + { + "title": "Upcoming Node.js Major Release", + "body": "A reminder that the next Node.js **semver major release** is scheduled for **${RELEASE_DATE}**.\n + Therefore, all commits that were landed until **${PR_MAX_DATE}** (one month prior to the release) will be included in the next semver major release.\n + + Please ensure that any necessary preparations are made in advance.\n + For more details on the release process, visit the [Node.js Release Working Group](https://github.com/nodejs/release).\n + + cc: @nodejs/collaborators" + } + EOF + curl --request POST \ + --url https://api.github.com/repos/${GITHUB_REPOSITORY}/issues \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data @body.json From e0e3ac05c152aa519d8124ad1b3d889ccfe79794 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Mon, 9 Dec 2024 15:54:31 -0300 Subject: [PATCH 2/7] fixup! build: add major release action --- .github/workflows/major-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index 27fdcd57fc41ff..4d9b93c3e5f73a 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -6,7 +6,7 @@ permissions: on: schedule: - - cron: '0 0 15 * *' + - cron: 0 0 15 * * jobs: create-issue: From 0f598435f15a68713385a6fa258cd61a5c507b09 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Wed, 11 Dec 2024 14:09:22 -0300 Subject: [PATCH 3/7] fixup! fixup! build: add major release action --- .github/workflows/major-release.yml | 42 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index 4d9b93c3e5f73a..2bda30f1877637 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -6,7 +6,7 @@ permissions: on: schedule: - - cron: 0 0 15 * * + - cron: 0 0 15 2,8 * # runs at midnight UTC every 15 February and 15 August jobs: create-issue: @@ -22,30 +22,28 @@ jobs: # We'll create the reminder issue two months prior the release if [[ "$MONTH" == "02" || "$MONTH" == "08" ]] && [[ "$DAY" == "15" ]]; then echo "create_issue=true" >> $GITHUB_ENV - release_date=$(date -d "$(date +%Y-%m-%d) +2 month" +"%d %B %Y") - echo "RELEASE_DATE=$release_date" >> $GITHUB_ENV - pr_max_date=$(date -d "$(date +%Y-%m-%d) +1 month" +"%d %B %Y") - echo "PR_MAX_DATE=$pr_max_date" >> $GITHUB_ENV - else - echo "create_issue=false" >> $GITHUB_ENV fi + - name: Calculate release date and version + if: env.create_issue == 'true' + run: | + curl -L https://github.com/nodejs/Release/raw/HEAD/schedule.json | \ + jq -r 'to_entries | map(select(.value.start | strptime("%Y-%m-%d") | mktime > now)) | first | "VERSION=" + .key + "\nRELEASE_DATE=" + .value.start' >> "$GITHUB_ENV" + - name: Calculate max date for PR + if: env.create_issue == 'true' + run: | + echo "PR_MAX_DATE=$(date -d "$RELEASE_DATE -1 month" +%Y-%m-%d)" >> "$GITHUB_ENV" - name: Create release announcement issue if: env.create_issue == 'true' run: | - cat < body.json - { - "title": "Upcoming Node.js Major Release", - "body": "A reminder that the next Node.js **semver major release** is scheduled for **${RELEASE_DATE}**.\n - Therefore, all commits that were landed until **${PR_MAX_DATE}** (one month prior to the release) will be included in the next semver major release.\n - - Please ensure that any necessary preparations are made in advance.\n - For more details on the release process, visit the [Node.js Release Working Group](https://github.com/nodejs/release).\n + gh issue create --repo "${GITHUB_REPOSITORY}" \ + --title "Upcoming Node.js Major Release ($VERSION)" \ + --body-file -< Date: Wed, 11 Dec 2024 19:51:11 -0300 Subject: [PATCH 4/7] fixup! fixup! fixup! build: add major release action --- .github/workflows/major-release.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index 2bda30f1877637..18b08ce8c64f5c 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -1,9 +1,5 @@ name: Major Release -permissions: - issues: write - contents: write - on: schedule: - cron: 0 0 15 2,8 * # runs at midnight UTC every 15 February and 15 August @@ -11,7 +7,9 @@ on: jobs: create-issue: runs-on: ubuntu-latest - + permissions: + issues: write + contents: read steps: - name: Check for release schedule id: check-date @@ -21,14 +19,14 @@ jobs: DAY=$(date +'%d') # We'll create the reminder issue two months prior the release if [[ "$MONTH" == "02" || "$MONTH" == "08" ]] && [[ "$DAY" == "15" ]]; then - echo "create_issue=true" >> $GITHUB_ENV + echo "create_issue=true" >> "$GITHUB_ENV" fi - - name: Calculate release date and version + - name: Retrieve next major release info from nodejs/Release if: env.create_issue == 'true' run: | curl -L https://github.com/nodejs/Release/raw/HEAD/schedule.json | \ jq -r 'to_entries | map(select(.value.start | strptime("%Y-%m-%d") | mktime > now)) | first | "VERSION=" + .key + "\nRELEASE_DATE=" + .value.start' >> "$GITHUB_ENV" - - name: Calculate max date for PR + - name: Compute max date for landing semver-major PRs if: env.create_issue == 'true' run: | echo "PR_MAX_DATE=$(date -d "$RELEASE_DATE -1 month" +%Y-%m-%d)" >> "$GITHUB_ENV" From 432563ef0b800f4c23a1f92562897315923c2cf5 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 12 Dec 2024 10:40:38 -0300 Subject: [PATCH 5/7] fixup! apply cr suggestion --- .github/workflows/major-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index 18b08ce8c64f5c..0830ec963f40bf 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -4,12 +4,14 @@ on: schedule: - cron: 0 0 15 2,8 * # runs at midnight UTC every 15 February and 15 August +permissions: + contents: read + jobs: create-issue: runs-on: ubuntu-latest permissions: issues: write - contents: read steps: - name: Check for release schedule id: check-date From 27cf99e428c284a417f1b62762d68c0137deef75 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Thu, 12 Dec 2024 16:32:50 -0300 Subject: [PATCH 6/7] Update .github/workflows/major-release.yml Co-authored-by: Tierney Cyren --- .github/workflows/major-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index 0830ec963f40bf..f127319219d47a 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -38,11 +38,11 @@ jobs: gh issue create --repo "${GITHUB_REPOSITORY}" \ --title "Upcoming Node.js Major Release ($VERSION)" \ --body-file -< Date: Sat, 14 Dec 2024 17:16:21 -0300 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Antoine du Hamel --- .github/workflows/major-release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/major-release.yml b/.github/workflows/major-release.yml index f127319219d47a..a90be1798fac85 100644 --- a/.github/workflows/major-release.yml +++ b/.github/workflows/major-release.yml @@ -39,10 +39,9 @@ jobs: --title "Upcoming Node.js Major Release ($VERSION)" \ --body-file -<