-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Automate CI/CD Workflow] #89
Changes from 16 commits
a48299a
8cf087a
9446b5d
b82e4c1
84c2c67
b3dbfa6
6f1ea07
83e7830
3c4f399
ff2e624
bc6e051
2685704
c594c21
fa83a79
d09b2c5
dbc6257
93437c0
55e4993
e825ed7
cc6ffc6
9142e2a
8b65130
554efbf
69426e0
93ebb8a
20c592e
9eb1103
27b65f8
e6ee32d
a173d7c
614d91d
9d964a9
67231dc
fcd531e
cd066dc
14ceef1
2a68d6a
7e819df
bb70a9d
8defe13
50600d2
f5a6a20
21f9b42
ee314b1
fbdcd1c
6f5b17b
e8c5cb1
80f607c
85d859e
1911ee2
1d0ffe3
1049549
682e66a
97d7084
be71a38
4697b57
354dd53
ef3cb0f
68535d4
9f330ae
0bd4e61
7feef6a
68ffcbb
13aad73
41b0c84
684e6a5
fdcf692
f50b9b6
dc28ef6
cb191eb
3f5f001
8eeb734
e2f2c43
01fb78c
aaa09fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Publish the latest release on PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
branches: | ||
- main # Restricts the workflow to only run on tags pushed to the main branch | ||
|
||
jobs: | ||
validate-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Validate Tag Format | ||
run: | | ||
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$' | ||
echo "Regex to match: $TAG_REGEX" | ||
TAG="${GITHUB_REF/refs\/tags\//}" | ||
echo "Tag extracted: $TAG" | ||
if [[ "$TAG" =~ $TAG_REGEX ]]; then | ||
echo "Tag format is valid." | ||
else | ||
echo "::error::Tag $TAG does not match the 'vMAJOR.MINOR.PATCH' or 'vMAJOR.MINOR.PATCH-pre-release' format." | ||
exit 1 | ||
fi | ||
shell: bash | ||
|
||
build-and-package: | ||
needs: validate-tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also here we should use And we can make sure all tests are run successfully before the build and publish as another safety There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a kind of dry publish. I used it in a test file, it works. So we can also add that simulation test before publish |
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry install | ||
|
||
# Comment out the pytest step | ||
# - name: Run tests | ||
# run: | | ||
# poetry run pytest | ||
|
||
- name: Build the distribution | ||
run: poetry build | ||
|
||
publish-to-pypi: | ||
needs: build-and-package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like overlap and repeating previous steps, not sure this is what you have designed on the workflow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is just a duplication. I will remove this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its stil repeating, im not sure why this has to be separate from the first, |
||
pip install poetry | ||
- name: Build the distribution | ||
run: poetry build | ||
- name: Publish | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_KEY }} | ||
build: true # Ensure the distribution is built before publishing | ||
|
||
create-github-release: | ||
needs: publish-to-pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create Release on GitHub | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} | ||
body: 'Automated release of version ${{ github.ref_name }}' | ||
draft: false | ||
prerelease: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets trigger on pr merge on release that we have to sort it out
and there is also stable and not stable release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I considered this, setting it to trigger on PRs that have a tag is more flexible and will be the future workflow. Setting it to main is more of centralized control for now.
I'd check more about stable and not stable release. I currently refer to llamaindex, langchain, etc.