forked from deepset-ai/haystack
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (66 loc) · 2.85 KB
/
minor_version_release.yml
File metadata and controls
79 lines (66 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Minor Version Release
on:
workflow_dispatch:
env:
PYTHON_VERSION: "3.9"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v5
with:
ref: main
- 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 main
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 main
# 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 main \
-H bump-version \
--title "Bump unstable version" \
--body "This PR bumps the unstable version for \`v2.x\`. \
The release branch \`v${{ steps.versions.outputs.current_release_minor }}.x\` has been correctly created. \
Verify documentation on Readme has been correctly updated before approving and merging this PR." \
--label "ignore-for-release-notes"
- uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install create_unstable_docs.py dependencies
run: pip install requests
- name: Release Readme version
env:
RDME_API_KEY: ${{ secrets.README_API_KEY }}
run: |
git checkout main
python ./.github/utils/create_unstable_docs.py --new-version ${{ steps.versions.outputs.current_release_minor }}