Skip to content

Commit e02c3cc

Browse files
committed
Automated Release Notes Generation (#5500)
(cherry picked from commit 0b9f5dd)
1 parent 363f31b commit e02c3cc

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release-Notes
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: 'The branch to generate release notes on'
7+
required: true
8+
schedule:
9+
- cron: "0 0/12 * * *"
10+
11+
jobs:
12+
13+
active-branches:
14+
runs-on: ubuntu-latest
15+
env:
16+
TASK_BRANCH: ${{ github.event.inputs.branch }}
17+
18+
steps:
19+
- id: dump-branches
20+
name: get branches from artifacts api
21+
if: ${{ ! github.event.inputs.branch }}
22+
run: |
23+
curl -s "https://artifacts-api.elastic.co/v1/branches" | jq "[ .branches[] | select(. | startswith(\"6\") | not) ]" --compact-output
24+
curl -s "https://artifacts-api.elastic.co/v1/branches" | jq "[ .branches[] | select(. | startswith(\"6\") | not) ]" --compact-output > branches.json
25+
26+
- id: set-matrix
27+
name: conditional command
28+
run: |
29+
if [[ "${{ github.event.inputs.branch }}" != "" ]]; then
30+
echo "::set-output name=matrix::['${{ github.event.inputs.branch }}']"
31+
elif [[ -f "branches.json" ]]; then
32+
echo "::set-output name=matrix::$(cat branches.json)"
33+
else
34+
echo "::set-output name=matrix::[]"
35+
fi
36+
outputs:
37+
matrix: ${{ steps.set-matrix.outputs.matrix }}
38+
39+
release-notes:
40+
name: Generate
41+
needs: active-branches
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
branch: ${{ fromJson(needs.active-branches.outputs.matrix) }}
47+
steps:
48+
- uses: actions/checkout@v2
49+
with:
50+
ref: "${{ matrix.branch }}"
51+
52+
- uses: actions/setup-dotnet@v1
53+
with:
54+
dotnet-version: '5.0.100'
55+
- name: Install dotnet-script
56+
run: dotnet tool install release-notes --tool-path dotnet-tool
57+
58+
- name: Find versions for branch
59+
id: versions
60+
run: |
61+
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)
62+
echo "::set-output name=current::$(echo ${lines[0]})"
63+
echo "::set-output name=next::$(echo ${lines[1]})"
64+
echo ${lines[@]}
65+
66+
- name: Generate release notes
67+
run: |
68+
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
69+
rm dotnet-tool/release-notes
70+
git status
71+
- name: "PR ${{ matrix.branch }}"
72+
# fixate to known release.
73+
uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8
74+
with:
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
branch: "fix/${{ matrix.branch }}/release-notes"
77+
base: "${{ matrix.branch }}"
78+
delete-branch: true
79+
commit-message: "[release-notes] Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch"
80+
title: '[release-notes] Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch'
81+
body: |
82+
Release notes ${{ steps.versions.outputs.next }} on ${{ matrix.branch }} branch
83+
labels: "infra,code-gen"

build/scripts/scripts.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<Content Include="..\..\.github\workflows\unified-release.yml"><Link>unified-release.yml</Link></Content>
3232
<Content Include="..\..\.github\workflows\make-codegen.yml"><Link>make-codegen.yml</Link></Content>
3333
<Content Include="..\..\.github\workflows\make-bump.yml"><Link>make-bump.yml</Link></Content>
34+
<Content Include="..\..\.github\workflows\make-release-notes.yml"><Link>make-release-notes.yml</Link></Content>
3435
</ItemGroup>
3536
<ItemGroup>
3637
<PackageReference Include="FSharp.Core" Version="5.0.0" />

0 commit comments

Comments
 (0)