From fc30663ce4f1c1d8fe8a049b3508f1e3f6a7b233 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 17 Jun 2023 06:44:02 -0700 Subject: [PATCH] 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. --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..49abe942d --- /dev/null +++ b/.github/workflows/release.yml @@ -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/*