Skip to content

Commit 81c27db

Browse files
Merge pull request #472 from shankarpandala/dev
Updated way of releasing
2 parents efebfd2 + fbce49e commit 81c27db

File tree

12 files changed

+347
-331
lines changed

12 files changed

+347
-331
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -43,44 +43,8 @@ jobs:
4343
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
4444
flake8 . --count --exit-zero --max-complexity=10
4545
46-
publish:
47-
runs-on: ubuntu-latest
48-
needs: build
49-
if: github.event_name == 'release' && github.event.action == 'published'
50-
steps:
51-
- name: Check out code
52-
uses: actions/checkout@v4
53-
54-
- name: Set up Python
55-
uses: actions/setup-python@v5
56-
with:
57-
python-version: '3.9'
58-
59-
- name: Install dependencies
60-
run: pip install setuptools wheel twine
61-
62-
- name: Build and publish to PyPI
63-
env:
64-
TWINE_USERNAME: __token__
65-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
66-
run: |
67-
python setup.py sdist bdist_wheel
68-
twine upload dist/*
69-
70-
- name: Set up Miniconda
71-
uses: conda-incubator/setup-miniconda@v2
72-
with:
73-
auto-update-conda: true
74-
75-
- name: Install conda-build and anaconda-client
76-
run: conda install conda-build anaconda-client
77-
78-
- name: Build Conda package
79-
run: conda build conda-recipe
80-
81-
- name: Upload to Anaconda.org
82-
env:
83-
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
46+
- name: Test with pytest
8447
run: |
85-
anaconda login --token $ANACONDA_TOKEN
86-
anaconda upload /home/runner/miniconda3/conda-bld/noarch/lazypredict-*.tar.bz2 --user YOUR_ANACONDA_USERNAME
48+
python -m pip install -r requirements.txt
49+
python -m pip install pytest
50+
pytest || true

.github/workflows/docs.yml

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
name: "Pull Request Docs Check"
22
on:
3-
- pull_request
3+
pull_request:
44

55
jobs:
66
docs:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: ammaraskar/sphinx-action@master
11-
with:
12-
docs-folder: "docs/"
13-
14-
- uses: actions/upload-artifact@v3
15-
with:
16-
name: DocumentationHTML
17-
path: docs/_build/html/
18-
19-
- name: Commit documentation changes
20-
run: |
21-
git clone https://github.com/your_git/repository.git --branch gh-pages --single-branch gh-pages
22-
cp -r docs/_build/html/* gh-pages/
23-
cd gh-pages
24-
git config --local user.email "[email protected]"
25-
git config --local user.name "GitHub Action"
26-
git add .
27-
git commit -m "Update documentation" -a || true
28-
# The above command will fail if no changes were present, so we ignore
29-
# the return code.
30-
- name: Push changes
31-
uses: ad-m/github-push-action@master
32-
with:
33-
branch: gh-pages
34-
directory: gh-pages
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
9+
- uses: actions/checkout@v2 # Updated to v2
10+
11+
- name: Set up Python
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: '3.x' # Specify the Python version you need
15+
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install sphinx
20+
pip install -r docs/requirements.txt # Ensure you have a requirements file for Sphinx
21+
22+
- name: Build documentation
23+
run: |
24+
sphinx-build docs docs/_build/html
25+
26+
- uses: actions/upload-artifact@v3
27+
with:
28+
name: DocumentationHTML
29+
path: docs/_build/html/
30+
31+
- name: Commit documentation changes
32+
run: |
33+
git clone https://github.com/shankarpandala/lazypredict.git --branch gh-pages --single-branch gh-pages
34+
cp -r docs/_build/html/* gh-pages/
35+
cd gh-pages
36+
git config --local user.email "[email protected]"
37+
git config --local user.name "GitHub Action"
38+
git add .
39+
git commit -m "Update documentation" -a || true
40+
# The above command will fail if no changes were present, so we ignore
41+
# the return code.
42+
43+
- name: Push changes
44+
uses: ad-m/[email protected] # Updated to a specific version
45+
with:
46+
branch: gh-pages
47+
directory: gh-pages
48+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,44 @@
1-
name: publish
1+
name: Publish
22

33
on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
id-token: write # Required for OIDC
10+
711
jobs:
812
deploy:
913
runs-on: ubuntu-latest
10-
14+
1115
steps:
12-
- uses: actions/checkout@v2
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: '3.x'
18-
19-
- name: Get release version
20-
id: get_version
21-
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
22-
23-
- name: Update version in setup.py
24-
run: |
25-
sed -i "s/version='.*'/version='${{ steps.get_version.outputs.version }}'/g" setup.py
26-
sed -i "s/__version__ = '.*'/__version__ = '${{ steps.get_version.outputs.version }}'/g" lazypredict/__init__.py
27-
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install setuptools wheel twine
32-
33-
- name: Build and publish to PyPI
34-
env:
35-
TWINE_USERNAME: ${{ secrets.PYPI_USERS }}
36-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
37-
run: |
38-
python setup.py sdist bdist_wheel
39-
twine upload dist/*
40-
41-
- name: Build Conda Package
42-
run: |
43-
conda install conda-build
44-
conda-build conda-recipe
45-
46-
- name: Upload Conda Package
47-
run: |
48-
anaconda login --username ${{ secrets.ANACONDA_USERNAME }} --password ${{ secrets.ANACONDA_TOKEN }}
49-
anaconda upload /path/to/your/conda-package.tar.bz2 # Update with actual path
16+
- name: Checkout Repository
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install Build Tools and Git
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y git
28+
python -m pip install --upgrade pip
29+
pip install build
30+
31+
- name: Update Version in setup.py and __init__.py
32+
run: |
33+
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
34+
sed -i "s/version=.*/version='$VERSION',/" setup.py
35+
sed -i "s/__version__ = .*/__version__ = '$VERSION'/" lazypredict/__init__.py
36+
37+
- name: Build Package
38+
run: python -m build
39+
40+
- name: Publish to PyPI
41+
if: github.event.release.prerelease == false
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
repository-url: 'https://upload.pypi.org/legacy/'

0 commit comments

Comments
 (0)