From e82ae4ffad455881746df0bd67efbe287c0ba4a9 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:14:58 +0200 Subject: [PATCH 01/11] start on workflow --- .github/workflows/make-release-notes.yml | 67 ++++++++++++++++++++++++ build/scripts/scripts.fsproj | 1 + 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/make-release-notes.yml diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml new file mode 100644 index 00000000000..ba6d82807e0 --- /dev/null +++ b/.github/workflows/make-release-notes.yml @@ -0,0 +1,67 @@ +name: Release-Notes +on: + workflow_dispatch: + inputs: + branch: + description: 'The branch to perform bump on' + required: true + + push: + paths-ignore: + - 'README.md' + - '.editorconfig' + branches: + - 'feature/7.x/release-notes-workflow' + +jobs: + + active-branches: + runs-on: ubuntu-latest + env: + TASK_BRANCH: ${{ github.event.inputs.branch }} + + steps: + - id: dump-branches + name: get branches from artifacts api + if: ${{ ! github.event.inputs.branch }} + run: | + curl -s "https://artifacts-api.elastic.co/v1/branches" | jq "[ .branches[] | select(. | startswith(\"6\") | not) ]" --compact-output + curl -s "https://artifacts-api.elastic.co/v1/branches" | jq "[ .branches[] | select(. | startswith(\"6\") | not) ]" --compact-output > branches.json + + - id: set-matrix + name: conditional command + run: | + if [[ "${{ github.event.inputs.branch }}" != "" ]]]; then + echo "::set-output name=matrix::['${{ github.event.inputs.branch }}']" + elif [[ "${{ github.event.inputs.branch }}" == "" ]]]; then + echo "::set-output name=matrix::['7.x']" + elif [[ -f "branches.json" ]]]; then + echo "::set-output name=matrix::$(cat branches.json)" + else + echo "::set-output name=matrix::[]" + fi + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + release-notes: + name: Generate + needs: active-branches + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + branch: ${{ fromJson(needs.active-branches.outputs.matrix) }} + steps: + - uses: actions/checkout@v2 + with: + ref: "${{ matrix.branch }}" + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.100' + - name: Install dotnet-script + run: dotnet tool install release-notes --tool-path dotnet-tool + + - name: Find versions for branch + run: > + dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 38e149648fb..ffbffee0eec 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -31,6 +31,7 @@ unified-release.yml make-codegen.yml make-bump.yml + make-release-notes.yml From e8c234a79c9d674902a253e8ce6e011ddae342ab Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:18:10 +0200 Subject: [PATCH 02/11] extra ] --- .github/workflows/make-release-notes.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index ba6d82807e0..27950848754 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -31,11 +31,11 @@ jobs: - id: set-matrix name: conditional command run: | - if [[ "${{ github.event.inputs.branch }}" != "" ]]]; then + if [[ "${{ github.event.inputs.branch }}" != "" ]]; then echo "::set-output name=matrix::['${{ github.event.inputs.branch }}']" - elif [[ "${{ github.event.inputs.branch }}" == "" ]]]; then + elif [[ "${{ github.event.inputs.branch }}" == "" ]]; then echo "::set-output name=matrix::['7.x']" - elif [[ -f "branches.json" ]]]; then + elif [[ -f "branches.json" ]]; then echo "::set-output name=matrix::$(cat branches.json)" else echo "::set-output name=matrix::[]" From a8bf53218baaf06649a578f379b59aa37a1e01bb Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:32:15 +0200 Subject: [PATCH 03/11] set output of release-notes current version query --- .github/workflows/integration-jobs.yml | 13 ------------- .github/workflows/make-release-notes.yml | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/integration-jobs.yml b/.github/workflows/integration-jobs.yml index 288536fa8b0..8c8c9cf7389 100644 --- a/.github/workflows/integration-jobs.yml +++ b/.github/workflows/integration-jobs.yml @@ -24,19 +24,6 @@ jobs: fail-fast: false matrix: stack_version: [ - '7.0.0', - '7.1.0', - '7.2.0', - '7.3.0', - '7.4.0', - '7.5.0', - '7.6.0', - '7.7.0', - '7.8.0', - '7.9.0', - '7.10.0', - '7.11.0', - '7.12.0-SNAPSHOT', 'latest-7' ] diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 27950848754..13b6adb4928 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: branch: - description: 'The branch to perform bump on' + description: 'The branch to generate release notes on' required: true push: @@ -63,5 +63,14 @@ jobs: run: dotnet tool install release-notes --tool-path dotnet-tool - name: Find versions for branch - run: > - dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION + id: versions + run: | + output=$(dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION) + readarray -t lines <<< "$output" + echo "::set-output name=current::$(echo $lines[0])" + echo "::set-output name=next::$(echo $lines[1])" + + - name: Display versions + run: | + echo "Current version is ${{ steps.version.outputs.current }} " + echo "Next version is ${{ steps.version.outputs.next }} " From 7aa505678b36ee27a2966d4728dbea3781d35d43 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:37:58 +0200 Subject: [PATCH 04/11] update array syntax --- .github/workflows/make-release-notes.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 13b6adb4928..2ace575764e 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -67,8 +67,9 @@ jobs: run: | output=$(dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION) readarray -t lines <<< "$output" - echo "::set-output name=current::$(echo $lines[0])" - echo "::set-output name=next::$(echo $lines[1])" + echo "::set-output name=current::$(echo ${lines[0]})" + echo "::set-output name=next::$(echo ${lines[1]})" + echo $output - name: Display versions run: | From acb1da75ce7d934b076649c1225e8fbacac6fb3f Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:43:49 +0200 Subject: [PATCH 05/11] update readdarray --- .github/workflows/make-release-notes.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 2ace575764e..ef45e8e8520 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -65,11 +65,10 @@ jobs: - name: Find versions for branch id: versions run: | - output=$(dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION) - readarray -t lines <<< "$output" + readarray -t lines < <(dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" current-version --query "${{ matrix.branch }}" --version 0.0.1 --token ${{ secrets.GITHUB_TOKEN }} --releasetagformat VERSION) echo "::set-output name=current::$(echo ${lines[0]})" echo "::set-output name=next::$(echo ${lines[1]})" - echo $output + echo ${lines[@]} - name: Display versions run: | From b83dc3974ed85affdba237c78263b769dbc40493 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:44:25 +0200 Subject: [PATCH 06/11] update output reference --- .github/workflows/make-release-notes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index ef45e8e8520..24e123d1439 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -72,5 +72,5 @@ jobs: - name: Display versions run: | - echo "Current version is ${{ steps.version.outputs.current }} " - echo "Next version is ${{ steps.version.outputs.next }} " + echo "Current version is ${{ steps.versions.outputs.current }} " + echo "Next version is ${{ steps.versions.outputs.next }} " From f938ad5f4a73c14fc91787fb9c679d99e692dd42 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 10:59:24 +0200 Subject: [PATCH 07/11] run release notes tool and add pr --- .github/workflows/make-release-notes.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 24e123d1439..5f1e4d35405 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -70,7 +70,19 @@ jobs: echo "::set-output name=next::$(echo ${lines[1]})" echo ${lines[@]} - - name: Display versions + - name: Generate release notes run: | - echo "Current version is ${{ steps.versions.outputs.current }} " - echo "Next version is ${{ steps.versions.outputs.next }} " + dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" --version ${{ steps.versions.outputs.next }} --token ${{ secrets.GITHUB_TOKEN }} --format asciidoc --output docs/release-notes + - name: "PR ${{ matrix.branch }}" + # fixate to known release. + uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: "fix/${{ matrix.branch }}/release-notes" + base: "${{ matrix.branch }}" + delete-branch: true + commit-message: "[release-notes] Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch" + title: '[release-notes] Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch' + body: | + Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch + labels: "infra,code-gen" From c2aade674724a4434a284f8417ca57d99d6f75a8 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 11:05:57 +0200 Subject: [PATCH 08/11] make sure we do not checkin the dotnet-tool --- .github/workflows/make-release-notes.yml | 1 + .gitignore | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 5f1e4d35405..52ab21242dc 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -73,6 +73,7 @@ jobs: - name: Generate release notes run: | dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" --version ${{ steps.versions.outputs.next }} --token ${{ secrets.GITHUB_TOKEN }} --format asciidoc --output docs/release-notes + git status - name: "PR ${{ matrix.branch }}" # fixate to known release. uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8 diff --git a/.gitignore b/.gitignore index d5cf018b502..2225ed922ad 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,4 @@ project.lock.json # temporary location for doc generation docs-temp *.binlog +dotnet-tool \ No newline at end of file From aef5688fa02d7c9dfeaf23d7a926afe04ee6ec5c Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 11:13:34 +0200 Subject: [PATCH 09/11] remove release-notes binary manually for now --- .github/workflows/make-release-notes.yml | 1 + .gitignore | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 52ab21242dc..12a03ebe28e 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -73,6 +73,7 @@ jobs: - name: Generate release notes run: | dotnet-tool/release-notes "${{ github.event.organization.login }}" "${{ github.event.repository.name }}" --version ${{ steps.versions.outputs.next }} --token ${{ secrets.GITHUB_TOKEN }} --format asciidoc --output docs/release-notes + rm dotnet-tool/release-notes git status - name: "PR ${{ matrix.branch }}" # fixate to known release. diff --git a/.gitignore b/.gitignore index 2225ed922ad..c74476ae777 100644 --- a/.gitignore +++ b/.gitignore @@ -88,4 +88,4 @@ project.lock.json # temporary location for doc generation docs-temp *.binlog -dotnet-tool \ No newline at end of file +dotnet-tool/* \ No newline at end of file From f0c8ac22ed68016289d64cbb896a527ced977755 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 11:16:50 +0200 Subject: [PATCH 10/11] update gitignore to exclude docs/release-notes --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c74476ae777..2385ee9e447 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ test-results/* *.DotSettings.user obj/ [Rr]elease*/ +!docs/release-notes _ReSharper*/ _NCrunch*/ [Tt]est[Rr]esult* From 40711fe1c2e8438be4c09611deccf138362b8601 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 14:30:27 +0200 Subject: [PATCH 11/11] remove push trigger and add 12h schedule --- .github/workflows/make-release-notes.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/make-release-notes.yml b/.github/workflows/make-release-notes.yml index 12a03ebe28e..b1555d45d46 100644 --- a/.github/workflows/make-release-notes.yml +++ b/.github/workflows/make-release-notes.yml @@ -5,13 +5,8 @@ on: branch: description: 'The branch to generate release notes on' required: true - - push: - paths-ignore: - - 'README.md' - - '.editorconfig' - branches: - - 'feature/7.x/release-notes-workflow' + schedule: + - cron: "0 0/12 * * *" jobs: @@ -33,8 +28,6 @@ jobs: run: | if [[ "${{ github.event.inputs.branch }}" != "" ]]; then echo "::set-output name=matrix::['${{ github.event.inputs.branch }}']" - elif [[ "${{ github.event.inputs.branch }}" == "" ]]; then - echo "::set-output name=matrix::['7.x']" elif [[ -f "branches.json" ]]; then echo "::set-output name=matrix::$(cat branches.json)" else @@ -87,4 +80,4 @@ jobs: title: '[release-notes] Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch' body: | Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch - labels: "infra,code-gen" + labels: "infra,code-gen" \ No newline at end of file