From bc5002ca106866e0e416f845299ff8597a4f7b5f Mon Sep 17 00:00:00 2001 From: daniloceano Date: Fri, 15 Aug 2025 12:01:31 -0300 Subject: [PATCH 1/2] Bump version to 0.1.3 - Fix duplicate CI/CD PyPI upload - Resolved issue where CI/CD runs on both develop push AND main merge - This prevents double publication attempts to PyPI - Future fix: Configure workflow to publish only on main branch --- CHANGELOG.md | 6 ++++++ setup.py | 2 +- src/__init__.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f487877..314b844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2025-08-15 + +### Fixed +- Resolved duplicate PyPI upload issue in CI/CD pipeline +- Fixed workflow configuration to prevent double publication + ## [0.1.2] - 2025-08-15 ### Fixed diff --git a/setup.py b/setup.py index eae2403..77435f1 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def read_readme(): setup( name='atmos-bud', - version='0.1.2', + version='0.1.3', description='Program for analyzing the heat, vorticity and humidity budgets of limited regions on the atmosphere.', long_description=read_readme(), long_description_content_type='text/markdown', diff --git a/src/__init__.py b/src/__init__.py index dd104b4..c40ecef 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -16,10 +16,10 @@ A comprehensive Python package for analyzing heat, vorticity, and humidity budgets of limited regions in the atmosphere using reanalysis data. -Version: 0.1.2 +Version: 0.1.3 """ -__version__ = "0.1.2" +__version__ = "0.1.3" __author__ = "Danilo Couto de Souza" __email__ = "danilo.oceano@gmail.com" __license__ = "GPL-3.0" From 9fc5b12dba33060cbcdf1c655cbdb31daf9e4b1a Mon Sep 17 00:00:00 2001 From: daniloceano Date: Fri, 15 Aug 2025 12:05:08 -0300 Subject: [PATCH 2/2] Fix CI/CD: Prevent duplicate PyPI uploads during PRs - Add conditional to publish only on push to main, not on PRs - Prevents double publication when PR is created AND merged - Maintains testing on both PRs and pushes for validation - This resolves the 'file already exists' PyPI upload errors --- .github/workflows/ci.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8726dcb..f307af9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: jobs: test: - runs-on: ubuntu-latest # Usando a última versão do Ubuntu + runs-on: ubuntu-latest steps: - name: Check out code @@ -24,27 +24,28 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt # Instalar dependências de acordo com seu requirements.txt + pip install -r requirements.txt - name: Install setuptools and wheel run: | - pip install setuptools wheel # Instalar setuptools e wheel para a criação de pacotes + pip install setuptools wheel - name: Run tests with pytest run: | - pytest # Rodando os testes com pytest + pytest - # Etapas para criação de distribuição + # Build distribution (sempre executa para validar) - name: Build distribution run: | - python setup.py sdist bdist_wheel # Criando os arquivos de distribuição + python setup.py sdist bdist_wheel - # Etapas para publicar no PyPI + # Publish to PyPI (APENAS quando push para main, não em PRs) - name: Publish to PyPI + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | - pip install twine # Instala o Twine para o upload - twine upload dist/* # Faz o upload dos pacotes gerados para o PyPI + pip install twine + twine upload dist/* env: - TWINE_USERNAME: "__token__" # Nome de usuário no PyPI para autenticação com token - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} # Usando o GitHub Secrets para o API token + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file