mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-05 03:28:09 +00:00
98 lines
3.5 KiB
YAML
98 lines
3.5 KiB
YAML
name: Minor Version Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to release"
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- v1.x
|
|
- v2.x
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.8"
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get branch name
|
|
id: branch
|
|
shell: python
|
|
run: |
|
|
import os
|
|
version = "${{ inputs.version }}"
|
|
branch = "v1.x" if version == "v1.x" else "main"
|
|
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
|
print(f"name={branch}", file=f)
|
|
|
|
- name: Checkout this repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: "${{ steps.branch.outputs.name }}"
|
|
|
|
- name: Define all versions
|
|
id: versions
|
|
shell: bash
|
|
# We only need `major.minor` in Readme so we cut the full version string to the first two tokens
|
|
run: |
|
|
echo "current_release_minor=$(cut -d "." -f 1,2 < VERSION.txt)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Bump version on ${{ steps.branch.outputs.name }}
|
|
shell: bash
|
|
env:
|
|
# We use the HAYSTACK_BOT_TOKEN here so the PR created by the step will
|
|
# trigger required workflows and can be merged by anyone
|
|
GITHUB_TOKEN: ${{ secrets.HAYSTACK_BOT_TOKEN }}
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git checkout "${{ steps.branch.outputs.name }}"
|
|
|
|
# Create the release branch from the current unstable
|
|
git checkout -b v${{ steps.versions.outputs.current_release_minor }}.x
|
|
git push -u origin v${{ steps.versions.outputs.current_release_minor }}.x
|
|
|
|
# Tag the base with X.Y.Z-rc0.
|
|
# At this point VERSION.txt still contains the previous version and not
|
|
# the one specified by the tag.
|
|
# This is good though as we just need this to make reno work properly.
|
|
NEW_VERSION=$(awk -F. '/[0-9]+\./{$2++;print}' OFS=. < VERSION.txt)
|
|
echo "$NEW_VERSION" > VERSION.txt
|
|
VERSION_TAG="v$NEW_VERSION"
|
|
git tag "$VERSION_TAG" -m"$VERSION_TAG"
|
|
git push --tags
|
|
|
|
# Create the branch that bump version in dev branch
|
|
cat VERSION.txt
|
|
git checkout -b bump-version
|
|
git add .
|
|
git commit -m "Update unstable version to $NEW_VERSION"
|
|
git push -u origin bump-version
|
|
|
|
# Create the PR
|
|
gh pr create -B "${{ steps.branch.outputs.name }}" \
|
|
-H bump-version \
|
|
--title "Bump unstable version" \
|
|
--body "This PR bumps the unstable version for ${{ inputs.version }}.\n \
|
|
The release branch \`v${{ steps.versions.outputs.current_release_minor }}.x\` has been correctly created.\n\
|
|
Verify documentation on Readme has been correctly updated before approving and merging this PR." \
|
|
--label "ignore-for-release-notes"
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "${{ env.PYTHON_VERSION }}"
|
|
|
|
- name: Install release_docs.py dependencies
|
|
run: pip install requests
|
|
|
|
- name: Release Readme version
|
|
env:
|
|
RDME_API_KEY: ${{ secrets.README_API_KEY }}
|
|
run: |
|
|
git checkout ${{ steps.branch.outputs.name }}
|
|
python ./.github/utils/release_docs.py --new-version ${{ steps.versions.outputs.current_release_minor }}
|