Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated cd workflow and Python Semantic Release table in pyproject.toml #71

Merged
merged 2 commits into from
Jan 21, 2024
Merged
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
33 changes: 17 additions & 16 deletions {{ cookiecutter.__package_slug }}/.github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
run: poetry run make html --directory docs/

cd:
permissions:
id-token: write
contents: write

# Only run this job if the "ci" job passes
needs: ci

Expand All @@ -56,27 +60,18 @@ jobs:
with:
fetch-depth: 0

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Use Python Semantic Release to prepare release
env:
# This token is created automatically by GH Actions
GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
run: |
git config user.name github-actions
git config user.email [email protected]
poetry run semantic-release publish
id: release
uses: python-semantic-release/[email protected]
with:
github_token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
user: __token__
password: {% raw %}${{ secrets.TEST_PYPI_API_TOKEN }}{% endraw %}
repository-url: https://test.pypi.org/legacy/
password: {% raw %}${{ secrets.TEST_PYPI_API_TOKEN }}{% endraw %}

- name: Test install from TestPyPI
run: |
Expand All @@ -87,6 +82,12 @@ jobs:

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
user: __token__
password: {% raw %}${{ secrets.PYPI_API_TOKEN }}{% endraw %}

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
Loading