forked from AsherBond/LightRAG
-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (92 loc) · 3.1 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (92 loc) · 3.1 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
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.1.2)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Determine version
id: version
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Release version: $VERSION"
- name: Update version in __init__.py
run: |
VERSION=${{ steps.version.outputs.VERSION }}
sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/" adalflow/adalflow/__init__.py
echo "Updated version to $VERSION in __init__.py"
cat adalflow/adalflow/__init__.py | head -1
- name: Update version in pyproject.toml
run: |
VERSION=${{ steps.version.outputs.VERSION }}
cd adalflow
poetry version $VERSION
echo "Updated version to $VERSION in pyproject.toml"
- name: Update CHANGELOG.md date
run: |
VERSION=${{ steps.version.outputs.VERSION }}
DATE=$(date +%Y-%m-%d)
sed -i "s/## \[$VERSION\] - .*/## [$VERSION] - $DATE/" adalflow/CHANGELOG.md
echo "Updated CHANGELOG.md with release date $DATE"
- name: Commit version updates
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add adalflow/adalflow/__init__.py adalflow/pyproject.toml adalflow/CHANGELOG.md
git diff --staged --quiet || git commit -m "chore: bump version to ${{ steps.version.outputs.VERSION }} [skip ci]"
- name: Build package
run: |
cd adalflow
poetry build
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: Release v${{ steps.version.outputs.VERSION }}
body: |
## AdalFlow v${{ steps.version.outputs.VERSION }}
See [CHANGELOG.md](https://github.com/SylphAI-Inc/AdalFlow/blob/main/adalflow/CHANGELOG.md) for details.
files: |
adalflow/dist/*
draft: false
prerelease: false
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
cd adalflow
poetry publish --skip-existing
- name: Push version updates to main
if: success()
run: |
git push origin HEAD:main || echo "No changes to push"