forked from deepset-ai/haystack-core-integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.72 KB
/
CI_pypi_release.yml
File metadata and controls
84 lines (71 loc) · 2.72 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
80
81
82
83
name: Core / Project release on PyPi
# The pushed tag must be formatted like so:
# * integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0
# * integrations/<INTEGRATION_FOLDER_NAME>-v1.0.0.post0 (for post-releases)
#
# For example, if we want to release version 1.0.99
# of the google-vertex-haystack integration we'd have to push the tag:
#
# integrations/google_vertex-v1.0.99
#
# For a final post-release (e.g., for archiving):
#
# integrations/google_vertex-v1.0.99.post0
on:
push:
tags:
- "**-v[0-9]+.[0-9]+.[0-9]+*"
jobs:
release-on-pypi:
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Install dependencies
run: pip install hatch requests
- name: Validate version number
run: python .github/utils/validate_version.py --tag ${{ github.ref_name }}
- name: Get project folder
id: pathfinder
shell: python
run: |
import os
project_path = "${{ github.ref_name }}".rsplit("-", maxsplit=1)[0]
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
print(f'project_path={project_path}', file=f)
- name: Build extra
working-directory: ${{ steps.pathfinder.outputs.project_path }}
run: hatch build
- name: Publish on PyPi
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: ${{ steps.pathfinder.outputs.project_path }}/dist
- name: Generate changelog
uses: orhun/git-cliff-action@c93ef52f3d0ddcdcc9bd5447d98d458a11cd4f72 # v4.7.1
env:
OUTPUT: "${{ steps.pathfinder.outputs.project_path }}/CHANGELOG.md"
with:
config: cliff.toml
args: >
--include-path "${{ steps.pathfinder.outputs.project_path }}/**/*"
--tag-pattern "${{ steps.pathfinder.outputs.project_path }}-v*"
- name: Commit changelog
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
with:
author_name: "HaystackBot"
author_email: "accounts@deepset.ai"
message: "Update the changelog"
add: ${{ steps.pathfinder.outputs.project_path }}
# to avoid that the pushed branch tip is behind its remote counterpart, we need to pull first
pull: "origin main --rebase --autostash"
push: origin HEAD:main