1
- name : Publish Python Package
1
+ name : Publish to PyPI, Anaconda, and Docker Hub
2
2
3
3
on :
4
4
push :
@@ -12,54 +12,75 @@ jobs:
12
12
runs-on : ubuntu-latest
13
13
steps :
14
14
- name : Checkout code
15
- uses : actions/checkout@v2
15
+ uses : actions/checkout@v3
16
16
17
17
- name : Set up Python
18
18
uses : actions/setup-python@v2
19
19
with :
20
20
python-version : ' 3.x'
21
21
22
- # Install dependencies for PyPI publishing
23
- - name : Install PyPI dependencies
22
+ - name : Install PyPI dependencies for publishing packages
24
23
run : |
25
24
python -m pip install --upgrade pip
26
25
pip install build
27
26
pip install twine
28
27
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/*
35
32
env :
36
33
TWINE_USERNAME : __token__
37
34
TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
38
35
39
-
40
- # Conda package building and publishing
41
36
- name : Install Conda and Conda-Build
42
37
run : |
43
38
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
44
39
bash miniconda.sh -b -p $HOME/miniconda
40
+ echo "source $HOME/miniconda/etc/profile.d/conda.sh" >> $GITHUB_ENV
45
41
source $HOME/miniconda/etc/profile.d/conda.sh
42
+ conda init bash
46
43
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
48
46
49
47
- name : Build Conda package
50
48
run : |
51
- conda build .
49
+ grayskull pypi readmeai
50
+ conda build readmeai
52
51
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
56
52
57
53
- name : Convert Conda package for other platforms
58
54
run : |
59
- conda convert --platform all $HOME/miniconda/conda-bld/linux-64/*.tar.bz2 --output-dir dist_conda/
55
+ conda convert --platform all $HOME/miniconda/conda-bld/linux-64/readmeai- *.tar.bz2 --output-dir dist_conda/
60
56
61
57
- name : Publish package to Anaconda
62
58
run : |
63
59
anaconda upload dist_conda/*/*.tar.bz2
64
60
env :
65
61
ANACONDA_API_TOKEN : ${{ secrets.ANACONDA_API_TOKEN }}
62
+
63
+ - name : Docker Hub build and push image.
64
+ run : |
65
+ echo "Waiting 30 seconds for Docker Hub to process the release..."
66
+ sleep 30
67
+
68
+ - name : Set up QEMU
69
+ uses : docker/setup-qemu-action@v2
70
+
71
+ - name : Set up Docker Buildx
72
+ uses : docker/setup-buildx-action@v2
73
+
74
+ - name : Login to Docker Hub
75
+ uses : docker/login-action@v2
76
+ with :
77
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
78
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
79
+
80
+ - name : Build and push Docker image
81
+ uses : docker/build-push-action@v4
82
+ with :
83
+ context : .
84
+ platforms : linux/amd64,linux/arm/v7,linux/arm64/v8
85
+ push : true
86
+ tags : zeroxeli/readme-ai:latest
0 commit comments