-
Notifications
You must be signed in to change notification settings - Fork 99
145 lines (123 loc) · 4.77 KB
/
Copy pathbyokg-rag-release.yml
File metadata and controls
145 lines (123 loc) · 4.77 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This workflow builds and publishes the BYOKG-RAG package to PyPI when a release is created.
name: BYOKG-RAG Release
on:
release:
types: [released]
jobs:
release-build:
# Constraint: Only run if the tag starts with 'graphrag-byokg-rag/v':
if: startsWith(github.ref, 'refs/tags/graphrag-byokg/v')
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.pypi_version }}
permissions:
contents: write
attestations: write
id-token: write
defaults:
run:
working-directory: byokg-rag
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
- name: Create virtual environment
run: uv venv .venv
- name: Install build dependencies
run: uv pip install --python .venv/bin/python build
- name: Build package
run: .venv/bin/python -m build
- name: Create latest dist copies
run: |
cp dist/*.whl dist/byokg-rag-latest.whl
cp dist/*.tar.gz dist/byokg-rag-latest.tar.gz
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: byokg-rag-dist
path: byokg-rag/dist/
- name: Extract version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME#graphrag-byokg/}"
else
VERSION="v$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "pypi_version=${VERSION#v}" >> $GITHUB_OUTPUT
- name: Zip byokg-rag source
run: |
zip -r dist/byokg-rag-${{ steps.version.outputs.version }}.zip \
src/ pyproject.toml README.md
cp dist/byokg-rag-${{ steps.version.outputs.version }}.zip dist/byokg-rag-latest.zip
- name: Upload byokg-rag zip artifact
uses: actions/upload-artifact@v7
with:
name: byokg-rag-zip
path: |
byokg-rag/dist/byokg-rag-${{ steps.version.outputs.version }}.zip
byokg-rag/dist/byokg-rag-latest.zip
retention-days: 30
- name: Zip byokg-rag notebooks
working-directory: examples/byokg-rag
run: |
zip byokg-notebooks.zip *.ipynb
cp byokg-notebooks.zip byokg-notebooks-${{ steps.version.outputs.version }}.zip
cp byokg-notebooks.zip byokg-notebooks-latest.zip
- name: Upload byokg-notebooks zip artifact
uses: actions/upload-artifact@v7
with:
name: byokg-notebooks
path: |
examples/byokg-rag/byokg-notebooks.zip
examples/byokg-rag/byokg-notebooks-${{ steps.version.outputs.version }}.zip
examples/byokg-rag/byokg-notebooks-latest.zip
retention-days: 30
- name: Generate checksums
working-directory: ${{ github.workspace }}
run: |
cd byokg-rag/dist && sha256sum *.whl *.tar.gz > SHA256SUMS && cd ${{ github.workspace }}
sha256sum examples/byokg-rag/byokg-notebooks-${{ steps.version.outputs.version }}.zip | sed 's|.*/||' >> byokg-rag/dist/SHA256SUMS
- name: Attest build provenance
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
with:
subject-path: |
byokg-rag/dist/*.whl
byokg-rag/dist/*.tar.gz
byokg-rag/dist/SHA256SUMS
examples/byokg-rag/byokg-notebooks-${{ steps.version.outputs.version }}.zip
- name: Attach artifacts to GitHub Release
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
with:
files: |
byokg-rag/dist/*
examples/byokg-rag/byokg-notebooks-${{ steps.version.outputs.version }}.zip
examples/byokg-rag/byokg-notebooks-latest.zip
prerelease: false
pypi-publish:
if: github.event.action == 'released'
runs-on: ubuntu-latest
needs: release-build
permissions:
id-token: write
attestations: write
environment:
name: pypi
url: https://pypi.org/project/graphrag-byokg/${{ needs.release-build.outputs.version }}
steps:
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: byokg-rag-dist
path: dist/
- name: Remove non-versioned dist copies
run: rm -f dist/*-latest.*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
with:
attestations: true