Skip to content

Commit eb85ba5

Browse files
committed
Create one action for uploading to conda, docker hub, and pypi.
1 parent d1cc88d commit eb85ba5

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed
Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Python Package
1+
name: Publish to PyPI, Anaconda, and Docker Hub
22

33
on:
44
push:
@@ -12,54 +12,75 @@ 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
4846
4947
- name: Build Conda package
5048
run: |
51-
conda build .
49+
grayskull pypi readmeai
50+
conda build readmeai
5251
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
5652

5753
- name: Convert Conda package for other platforms
5854
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/
6056
6157
- name: Publish package to Anaconda
6258
run: |
6359
anaconda upload dist_conda/*/*.tar.bz2
6460
env:
6561
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

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "readmeai"
7-
version = "0.4.072"
7+
version = "0.4.073"
88
description = "🚀 Generate beautiful README files from the terminal, powered by OpenAI's GPT language models 💫"
99
authors = ["Eli <[email protected]>"]
1010
license = "MIT"
@@ -54,7 +54,6 @@ pydantic = ">=1.10.9,<2.0.0"
5454
aiohttp = "^3.8.5"
5555
click = "^8.1.7"
5656

57-
5857
[tool.poetry.dev-dependencies]
5958
black = "*"
6059
flake8 = "*"
@@ -90,7 +89,7 @@ exclude = '''
9089
| dist
9190
)/
9291
'''
93-
virtual_env = "venv"
92+
virtual_env = "poetry"
9493

9594
[tool.isort]
9695
line_length = 79

0 commit comments

Comments
 (0)