Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_rendered_project(
cd_data = yaml.safe_load(f.read())
assert ci_data["env"]["ENABLE_COVERAGE"] == enable_coverage
assert cd_data["env"]["ENABLE_PYPI_PUBLISH"] == enable_pypi_publish
assert cd_data["env"]["ENABLE_TEST_PYPI_PUBLISH"] == enable_pypi_publish
assert cd_data["env"]["ENABLE_TEST_PYPI_PUBLISH"] is False

assert not (
subprocess.check_output(
Expand Down
11 changes: 6 additions & 5 deletions {{cookiecutter.project_name}}/.github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ name: Release

env:
ENABLE_PYPI_PUBLISH: {{ "true" if cookiecutter.enable_pypi_publish|lower == "yes" else "false" }}
ENABLE_TEST_PYPI_PUBLISH: {{ "true" if cookiecutter.enable_pypi_publish|lower == "yes" else "false" }}
ENABLE_TEST_PYPI_PUBLISH: false
RELEASE_PYTHON_VERSION: "3.12"
RELEASE_POETRY_VERSION: "2.0"

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
Publish:
name: Publish package for ${{ "{{" }} github.ref_name }}

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/{{ cookiecutter.project_name }}
permissions:
id-token: write

steps:
- name: 💾 Check out repository
Expand Down Expand Up @@ -49,15 +53,12 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ "{{" }} env.ENABLE_TEST_PYPI_PUBLISH == 'true' }}
with:
password: ${{ "{{" }} secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: ☢️ Publish to PyPI
if: ${{ "{{" }} env.ENABLE_PYPI_PUBLISH == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ "{{" }} secrets.PYPI_API_TOKEN }}

concurrency:
group: ${{ "{{" }} github.workflow }}-${{ "{{" }} github.ref }}
Expand Down
Loading