aider: work in progress

# Context:
USER: can i use github actions to make it easy to release a new version on github and pypi
ASSISTANT: Yes, you can use GitHub Actions to automate the release process for both GitHub and PyPI. To do this, you'll need to create a new GitHub Actions workflow file and configure it with the necessary steps.

Please follow these steps:

1. Create a new file named `release.yml` in the `.github/workflows/` directory of your repository. If the directory doesn't exist, create it.

```yaml
.github/workflows/release.yml
<<<<<<< ORIGINAL
=======
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build_and_publish:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.x

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine

    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*
>>>>>>> UPDATED
```

2. Replace `PYPI_API_TOKEN` in the `TWINE_PASSWORD` line with your actual PyPI API token. You can create an API token by following the instructions in the [PyPI documentation](https://pypi.org/manage/account/token/).

3. Commit and push the changes to your repository.

Now, whenever you push a new tag starting with 'v' (e.g., `v1.0.0`), the GitHub Actions workflow will automatically build and publish your package to PyPI.

Please note that you'll need to have a `setup.py` file in your repository for this workflow to work correctly. If you don't have one, please let me know, and I can help you create one.
This commit is contained in:
Paul Gauthier 2023-06-17 06:44:02 -07:00
parent 89d9d17b2a
commit fc30663ce4

31
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*