mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-22 04:33:53 +00:00
* squash * fail with message if unable to fetch contributors * add comment about permissions
103 lines
4.2 KiB
YAML
103 lines
4.2 KiB
YAML
name: Project release on Github
|
|
|
|
on:
|
|
workflow_dispatch: # this is useful to re-generate the release page without a new tag being pushed
|
|
push:
|
|
tags:
|
|
- "v2.[0-9]+.[0-9]+*"
|
|
# Ignore release versions tagged with -rc0 suffix
|
|
- "!v2.[0-9]+.[0-9]-rc0"
|
|
jobs:
|
|
generate-notes:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-tags: true
|
|
fetch-depth: 0 # slow but needed by reno
|
|
|
|
- name: Parse version
|
|
id: version
|
|
run: |
|
|
echo "current_release=$(awk -F \\- '{print $1}' < VERSION.txt)" >> "$GITHUB_OUTPUT"
|
|
echo "current_pre_release=$(awk -F \\- '{print $2}' < VERSION.txt)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Install reno
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install "reno<5"
|
|
|
|
- name: Generate release notes for release candidates - minor releases
|
|
if: steps.version.outputs.current_pre_release != '' && endsWith(steps.version.outputs.current_release, '.0')
|
|
env:
|
|
# When generating notes for release candidates of minor versions, pick every vX.Y.Z-rcN but
|
|
# stop when encounter vX.Y.Z-rc0. The -rc0 tag is added automatically when
|
|
# we create the release branch, so we can assume it's always there.
|
|
EARLIEST_VERSION: v${{ steps.version.outputs.current_release }}-rc0
|
|
run: |
|
|
reno report --no-show-source --ignore-cache --earliest-version "$EARLIEST_VERSION" -o relnotes.rst
|
|
|
|
- name: Generate release notes for release candidates - bugfix releases
|
|
if: steps.version.outputs.current_pre_release != '' && !endsWith(steps.version.outputs.current_release, '.0')
|
|
env:
|
|
# When generating notes for release candidates of bugfix releases, pick every vX.Y.Z-rcN but
|
|
# stop when encounter vX.Y.Z-rc1.
|
|
# In this case, we don't have the -rc0 tag, because we don't need to go through commits on main,
|
|
# as we cherry-pick them into the release branch.
|
|
EARLIEST_VERSION: v${{ steps.version.outputs.current_release }}-rc1
|
|
run: |
|
|
reno report --no-show-source --ignore-cache --earliest-version "$EARLIEST_VERSION" -o relnotes.rst
|
|
|
|
- name: Generate release notes for the final release
|
|
if: steps.version.outputs.current_pre_release == ''
|
|
# When generating notes for the final release vX.Y.Z, we just pass --version and reno
|
|
# will automatically collapse all the vX.Y.Z-rcN.
|
|
run: |
|
|
reno report --no-show-source --ignore-cache --version v${{ steps.version.outputs.current_release }} -o relnotes.rst
|
|
|
|
- name: Convert to Markdown
|
|
uses: docker://pandoc/core:3.8
|
|
with:
|
|
args: "--from rst --to gfm --syntax-highlighting=none --wrap=none relnotes.rst -o relnotes.md"
|
|
|
|
# We copy the relnotes file since the original one cannot be modified due to permissions
|
|
- name: Copy relnotes file
|
|
run: |
|
|
cat relnotes.md > enhanced_relnotes.md
|
|
|
|
- name: Add contributor list
|
|
# only for minor releases and minor release candidates (not bugfix releases)
|
|
if: endsWith(steps.version.outputs.current_release, '.0')
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
START: v${{ steps.version.outputs.current_release }}-rc0
|
|
END: ${{ github.ref_name }}
|
|
run: |
|
|
JQ_EXPR='[.commits[].author.login]
|
|
| map(select(. != null and . != "HaystackBot" and . != "dependabot[bot]"))
|
|
| unique
|
|
| sort_by(ascii_downcase)
|
|
| map("@\(.)")
|
|
| join(", ")'
|
|
CONTRIBUTORS=$(gh api "repos/deepset-ai/haystack/compare/$START...$END" \
|
|
--jq "$JQ_EXPR") || { echo "Unable to fetch contributors"; exit 1; }
|
|
|
|
{
|
|
echo ""
|
|
echo "## 💙 Big thank you to everyone who contributed to this release!"
|
|
echo ""
|
|
echo "$CONTRIBUTORS"
|
|
} >> enhanced_relnotes.md
|
|
|
|
- name: Debug
|
|
run: |
|
|
cat enhanced_relnotes.md
|
|
|
|
- uses: ncipollo/release-action@v1
|
|
with:
|
|
bodyFile: "enhanced_relnotes.md"
|
|
prerelease: ${{ steps.version.outputs.current_pre_release != '' }}
|
|
allowUpdates: true
|