Skip to content

Commit 63eca8d

Browse files
committed
build: add create release proposal action
1 parent e49cf7a commit 63eca8d

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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/20/18'
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+
env:
32+
STAGING_BRANCH: v${{ inputs.release-line }}.x-staging
33+
RELEASE_BRANCH: v${{ inputs.release-line }}.x
34+
RELEASE_DATE: ${{ inputs.release-date }}
35+
releasePrepare:
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+
token: ${{ secrets.GH_USER_TOKEN }}
45+
46+
# Install dependencies
47+
- name: Install Node.js
48+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
49+
with:
50+
node-version: ${{ env.NODE_VERSION }}
51+
52+
- name: Install @node-core/utils
53+
run: npm install -g @node-core/utils
54+
55+
- name: Set variables
56+
run: |
57+
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
58+
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
59+
60+
- name: Configure @node-core/utils
61+
run: |
62+
ncu-config set branch ${{ env.RELEASE_BRANCH }}
63+
ncu-config set upstream origin
64+
ncu-config set username "$USERNAME"
65+
ncu-config set token "$GH_TOKEN"
66+
ncu-config set jenkins_token "$JENKINS_TOKEN"
67+
ncu-config set repo "${REPOSITORY}"
68+
ncu-config set owner "${OWNER}"
69+
env:
70+
USERNAME: ${{ secrets.JENKINS_USER }}
71+
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
72+
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
73+
74+
- name: Start git node release prepare
75+
run: ./tools/actions/create-release.sh ${{ inputs.RELEASE_DATE }}

tools/actions/create-release.sh

Lines changed: 15 additions & 0 deletions
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+
7+
git node release --prepare --skipBranchDiff
8+
# We use it to not specify the branch name as it changes based on
9+
# the commit list (semver-minor/semver-patch)
10+
git config push.default current
11+
git push upstream
12+
echo "/## $RELEASE_DATE/,/^<a id=/{ if (!/^<a id=/) print }" > temp.awk
13+
awk -f temp.awk doc/changelogs/CHANGELOG_V23.md > pr-body.md
14+
gh pr create --body-file pr-body.md
15+
# TODO: ammend with proposal PR

0 commit comments

Comments
 (0)