build: add major release action · nodejs/node@dbb7557

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,48 @@

1+

name: Major Release

2+
3+

on:

4+

schedule:

5+

- cron: 0 0 15 2,8 * # runs at midnight UTC every 15 February and 15 August

6+
7+

permissions:

8+

contents: read

9+
10+

jobs:

11+

create-issue:

12+

runs-on: ubuntu-latest

13+

permissions:

14+

issues: write

15+

steps:

16+

- name: Check for release schedule

17+

id: check-date

18+

run: |

19+

# Get the current month and day

20+

MONTH=$(date +'%m')

21+

DAY=$(date +'%d')

22+

# We'll create the reminder issue two months prior the release

23+

if [[ "$MONTH" == "02" || "$MONTH" == "08" ]] && [[ "$DAY" == "15" ]]; then

24+

echo "create_issue=true" >> "$GITHUB_ENV"

25+

fi

26+

- name: Retrieve next major release info from nodejs/Release

27+

if: env.create_issue == 'true'

28+

run: |

29+

curl -L https://github.com/nodejs/Release/raw/HEAD/schedule.json | \

30+

jq -r 'to_entries | map(select(.value.start | strptime("%Y-%m-%d") | mktime > now)) | first | "VERSION=" + .key + "\nRELEASE_DATE=" + .value.start' >> "$GITHUB_ENV"

31+

- name: Compute max date for landing semver-major PRs

32+

if: env.create_issue == 'true'

33+

run: |

34+

echo "PR_MAX_DATE=$(date -d "$RELEASE_DATE -1 month" +%Y-%m-%d)" >> "$GITHUB_ENV"

35+

- name: Create release announcement issue

36+

if: env.create_issue == 'true'

37+

run: |

38+

gh issue create --repo "${GITHUB_REPOSITORY}" \

39+

--title "Upcoming Node.js Major Release ($VERSION)" \

40+

--body-file -<<EOF

41+

A reminder that the next Node.js **SemVer Major release** is scheduled for **${RELEASE_DATE}**.

42+

All commits that were landed until **${PR_MAX_DATE}** (one month prior to the release) will be included in the next semver major release. Please ensure that any necessary preparations are made in advance.

43+

For more details on the release process, consult the [Node.js Release Working Group repository](https://github.com/nodejs/release).

44+
45+

cc: @nodejs/collaborators

46+

EOF

47+

env:

48+

GH_TOKEN: ${{ github.token }}