Skip to content

Release-Notes

Release-Notes #139

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@v3
with:
ref: "${{ matrix.branch }}"
- uses: actions/setup-dotnet@v4
with:
global-json-file: 'global.json'
- name: Install dotnet-script
run: dotnet tool install release-notes --tool-path dotnet-tool
- name: Set repository name environment variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Find versions for branch
id: versions
run: |
readarray -t lines < <(dotnet-tool/release-notes "${{ github.repository_owner }}" "${{ env.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.repository_owner }}" "${{ env.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"