# ============================================================================= # AngelaMos | 2026 # publish-caesar-cipher.yml # ============================================================================= name: Publish caesar-salad-cipher to PyPI on: push: branches: - main paths: - 'PROJECTS/beginner/caesar-cipher/**' - '!PROJECTS/beginner/caesar-cipher/README.md' - '!PROJECTS/beginner/caesar-cipher/Justfile' permissions: contents: read jobs: pypi-publish: name: Upload caesar-salad-cipher to PyPI runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/caesar-salad-cipher permissions: id-token: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Check if version exists on PyPI id: version_check working-directory: PROJECTS/beginner/caesar-cipher run: | VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/caesar-salad-cipher/${VERSION}/json") if [ "$STATUS" = "200" ]; then echo "exists=true" >> "$GITHUB_OUTPUT" echo "::notice::caesar-salad-cipher v${VERSION} already on PyPI — skipping publish" else echo "exists=false" >> "$GITHUB_OUTPUT" echo "::notice::caesar-salad-cipher v${VERSION} not on PyPI — publishing" fi - name: Install build dependencies if: steps.version_check.outputs.exists != 'true' run: | python -m pip install --upgrade pip pip install build - name: Build package if: steps.version_check.outputs.exists != 'true' working-directory: PROJECTS/beginner/caesar-cipher run: python -m build - name: Publish to PyPI if: steps.version_check.outputs.exists != 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: PROJECTS/beginner/caesar-cipher/dist/