forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (76 loc) · 3.15 KB
/
create-release-proposal.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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
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'
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: write
pull-requests: write
jobs:
releasePrepare:
env:
STAGING_BRANCH: v${{ inputs.release-line }}.x-staging
RELEASE_BRANCH: v${{ inputs.release-line }}.x
RELEASE_DATE: ${{ inputs.release-date }}
RELEASE_LINE: ${{ inputs.release-line }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ env.STAGING_BRANCH }}
persist-credentials: false
# 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: Configure @node-core/utils
run: |
ncu-config set branch "${RELEASE_BRANCH}"
ncu-config set upstream origin
ncu-config set username "$USERNAME"
ncu-config set token "$GH_TOKEN"
ncu-config set repo "$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)"
ncu-config set owner "${GITHUB_REPOSITORY_OWNER}"
env:
USERNAME: ${{ secrets.JENKINS_USER }}
GH_TOKEN: ${{ github.token }}
- name: Set up ghauth config (Ubuntu)
run: |
mkdir -p "${XDG_CONFIG_HOME:-~/.config}/changelog-maker"
echo '{}' | jq '{user: env.USERNAME, token: env.TOKEN}' > "${XDG_CONFIG_HOME:-~/.config}/changelog-maker/config.json"
env:
USERNAME: ${{ secrets.JENKINS_USER }}
TOKEN: ${{ github.token }}
- name: Setup git author
run: |
git config --local user.email "[email protected]"
git config --local user.name "Node.js GitHub Bot"
# Workaround, see https://github.com/nodejs/node-core-utils/pull/876
git fetch origin --shallow-exclude ${{ inputs.release-line }}.0.0 "$STAGING_BRANCH"
- name: Start git node release prepare
# The curl command is to make sure we run the version of the script corresponding to the current workflow.
run: |
curl -L https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/tools/actions/create-release.sh > tools/actions/create-release.sh
./tools/actions/create-release.sh "${RELEASE_DATE}" "${RELEASE_LINE}"
env:
GH_TOKEN: ${{ github.token }}
# We want the bot to push the push the release commit so Ci runs on it.
BOT_TOKEN: ${{ secrets.GH_USER_TOKEN }}