From fbd5e2a5a09d4880db6845cc02a78f8935863bf6 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 31 Mar 2021 14:52:01 +0200 Subject: [PATCH] Automated Release Notes Generation (#5500) --- .github/workflows/integration-jobs.yml | 13 ---- .github/workflows/make-release-notes.yml | 83 ++++++++++++++++++++++++ build/scripts/scripts.fsproj | 1 + 3 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/make-release-notes.yml 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 new file mode 100644 index 00000000000..b1555d45d46 --- /dev/null +++ b/.github/workflows/make-release-notes.yml @@ -0,0 +1,83 @@ +name: Release-Notes +on: + workflow_dispatch: + inputs: + branch: + description: 'The branch to generate release notes on' + required: true + schedule: + - cron: "0 0/12 * * *" + +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 [[ -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 + id: versions + run: | + 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 ${lines[@]} + + - 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. + 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" \ No newline at end of file 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