Skip to content

Commit 61cec55

Browse files
committed
build: add create release proposal action
PR-URL: nodejs#55690
1 parent e49cf7a commit 61cec55

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This action requires the following secrets to be set on the repository:
2+
# GH_USER_NAME: GitHub user whose Jenkins and GitHub token are defined below
3+
# GH_USER_TOKEN: GitHub user token, to be used by ncu and to push changes
4+
# JENKINS_TOKEN: Jenkins token, to be used to check CI status
5+
6+
name: Create Release Proposal
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
release-line:
12+
required: true
13+
type: number
14+
default: 23
15+
description: 'The release line (without dots or prefix). e.g: 22'
16+
release-date:
17+
required: true
18+
type: string
19+
default: YYYY-MM-DD
20+
description: The release date in YYYY-MM-DD format
21+
22+
concurrency: ${{ github.workflow }}
23+
24+
env:
25+
NODE_VERSION: lts/*
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
releasePrepare:
32+
env:
33+
STAGING_BRANCH: v${{ inputs.release-line }}.x-staging
34+
RELEASE_BRANCH: v${{ inputs.release-line }}.x
35+
RELEASE_DATE: ${{ inputs.release-date }}
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
39+
with:
40+
branch: ${{ env.STAGING_BRANCH }}
41+
# Needs the whole git history for ncu to work
42+
# See https://github.com/nodejs/node-core-utils/pull/486
43+
fetch-depth: 0
44+
45+
# Install dependencies
46+
- name: Install Node.js
47+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
48+
with:
49+
node-version: ${{ env.NODE_VERSION }}
50+
51+
- name: Install @node-core/utils
52+
run: npm install -g @node-core/utils
53+
54+
- name: Configure @node-core/utils
55+
run: |
56+
ncu-config set branch "${RELEASE_BRANCH}"
57+
ncu-config set upstream origin
58+
ncu-config set username "$USERNAME"
59+
ncu-config set token "$GH_TOKEN"
60+
ncu-config set jenkins_token "$JENKINS_TOKEN"
61+
ncu-config set repo "$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)"
62+
ncu-config set owner "${GITHUB_REPOSITORY_OWNER}"
63+
env:
64+
USERNAME: ${{ secrets.JENKINS_USER }}
65+
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
66+
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
67+
68+
- name: Start git node release prepare
69+
run: |
70+
./tools/actions/create-release.sh "${RELEASE_DATE}" '${{ inputs.release-line }}'

tools/actions/create-release.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -xe
4+
5+
RELEASE_DATE=$1
6+
RELEASE_LINE=$2
7+
8+
git node release --prepare --skipBranchDiff
9+
# We use it to not specify the branch name as it changes based on
10+
# the commit list (semver-minor/semver-patch)
11+
git config push.default current
12+
awk "/## ${RELEASE_DATE}/,/^<a id=/{ if (!/^<a id=/) print }" \
13+
"doc/changelogs/CHANGELOG_V${RELEASE_LINE}.md" |\
14+
gh pr create --body-file -
15+
# TODO: ammend with proposal PR

0 commit comments

Comments
 (0)