-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: add create release proposal action #55690
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -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 }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need the special token, it's only checking out a branch? |
||||||
|
||||||
# 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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should probably store "github.repository" in an environment variable, IMO it's cleaner + it's best practice |
||||||
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not set this when the rest of the environment is set? |
||||||
|
||||||
- name: Configure @node-core/utils | ||||||
run: | | ||||||
ncu-config set branch ${{ env.RELEASE_BRANCH }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. storing the input in an environment variable is best practice |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably should not expect to have push permission, and instead make an API call to create the release commit using a |
||
echo "/## $RELEASE_DATE/,/^<a id=/{ if (!/^<a id=/) print }" > 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you merge this with the env a few lines above?