From 2b56c80bcb3862b0005101520a2e6394c71ad1df Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Fri, 1 Nov 2024 14:52:17 -0300 Subject: [PATCH] build: add create release proposal action --- .github/workflows/create-release-proposal.yml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/create-release-proposal.yml diff --git a/.github/workflows/create-release-proposal.yml b/.github/workflows/create-release-proposal.yml new file mode 100644 index 00000000000000..d439635865f958 --- /dev/null +++ b/.github/workflows/create-release-proposal.yml @@ -0,0 +1,76 @@ +# 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-type: + required: true + type: string + default: 'minor' + description: 'The release type. It can be either "minor" or "patch"' + +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 + 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 }} + + # 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 + echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV + + - name: Configure @node-core/utils + run: | + ncu-config set branch ${{ env.RELEASE_BRANCH }} + 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 the Commit Queue + # run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ needs.get_mergeable_prs.outputs.numbers }} + # env: + # GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}