1- name : Publish Python Package
1+ name : Publish to PyPI, Anaconda, and Docker Hub
22
33on :
44 push :
@@ -12,54 +12,76 @@ jobs:
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout code
15- uses : actions/checkout@v2
15+ uses : actions/checkout@v3
1616
1717 - name : Set up Python
1818 uses : actions/setup-python@v2
1919 with :
2020 python-version : ' 3.x'
2121
22- # Install dependencies for PyPI publishing
23- - name : Install PyPI dependencies
22+ - name : Install PyPI dependencies for publishing packages
2423 run : |
2524 python -m pip install --upgrade pip
2625 pip install build
2726 pip install twine
2827
29- # Build and publish to PyPI
30- - name : Build package for PyPI
31- run : python -m build
32-
33- - name : Publish package to PyPI
34- run : python -m twine upload --skip-existing dist/*
28+ - name : Build and publish to PyPI
29+ run : |
30+ python -m build
31+ python -m twine upload --skip-existing dist/*
3532 env :
3633 TWINE_USERNAME : __token__
3734 TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
3835
39-
40- # Conda package building and publishing
4136 - name : Install Conda and Conda-Build
4237 run : |
4338 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
4439 bash miniconda.sh -b -p $HOME/miniconda
40+ echo "source $HOME/miniconda/etc/profile.d/conda.sh" >> $GITHUB_ENV
4541 source $HOME/miniconda/etc/profile.d/conda.sh
42+ conda init bash
4643 conda update --yes conda
47- conda install --yes conda-build # Install conda-build
44+ conda install --yes conda-build
45+ conda install -c conda-forge grayskull
46+ shell : bash -l {0}
4847
49- - name : Build Conda package
48+ - name : Generate Conda recipe
5049 run : |
51- conda build .
52- shell : /usr/bin/bash -e {0}
53- env :
54- pythonLocation : /opt/hostedtoolcache/Python/3.12.0/x64
55- LD_LIBRARY_PATH : /opt/hostedtoolcache/Python/3.12.0/x64/lib
50+ grayskull pypi readmeai
51+ conda build readmeai
52+ shell : bash -l {0}
5653
5754 - name : Convert Conda package for other platforms
5855 run : |
59- conda convert --platform all $HOME/miniconda/conda-bld/linux-64/*.tar.bz2 --output-dir dist_conda/
56+ conda convert --platform all $HOME/miniconda/conda-bld/linux-64/readmeai- *.tar.bz2 --output-dir dist_conda/
6057
6158 - name : Publish package to Anaconda
6259 run : |
6360 anaconda upload dist_conda/*/*.tar.bz2
6461 env :
6562 ANACONDA_API_TOKEN : ${{ secrets.ANACONDA_API_TOKEN }}
63+
64+ - name : Docker Hub build and push image.
65+ run : |
66+ echo "Waiting 30 seconds for Docker Hub to process the release..."
67+ sleep 30
68+
69+ - name : Set up QEMU
70+ uses : docker/setup-qemu-action@v2
71+
72+ - name : Set up Docker Buildx
73+ uses : docker/setup-buildx-action@v2
74+
75+ - name : Login to Docker Hub
76+ uses : docker/login-action@v2
77+ with :
78+ username : ${{ secrets.DOCKERHUB_USERNAME }}
79+ password : ${{ secrets.DOCKERHUB_TOKEN }}
80+
81+ - name : Build and push Docker image
82+ uses : docker/build-push-action@v4
83+ with :
84+ context : .
85+ platforms : linux/amd64,linux/arm/v7,linux/arm64/v8
86+ push : true
87+ tags : zeroxeli/readme-ai:latest
0 commit comments