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

Automatic release to pypi #39

Merged
merged 3 commits into from
Jan 12, 2022
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
24 changes: 24 additions & 0 deletions .github/workflows/auto_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: auto_pypi

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Building package distribution
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ It's just a template repository for python, with the following features :
* :octocat: CI with [Github actions](https://github.com/features/actions)
* 📝 Issues & PR templates
* 🤖 Stale bot & Dependabot
* 🚀 Releases automatically uploaded to PyPi
* 🚀 Releases automatically published to PyPi


<h2 align="center">Install</h2>
Expand Down
8 changes: 7 additions & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,19 @@ Two Github actions are used for CI : one for the code format, and one for the un

Continuous Deployment (_CD_) is here to automatically deploying whatever needs to be deployed. It avoids manual labor.

Two Github actions are used for CD : one for deploying the latest documentation (_ran whenever a commit is pushed in the main branch_), and one for deploying the documentation of stable versions (_ran whenever a release is published_).
Three Github actions are used for CD :

* Deploying the latest documentation (_ran whenever a commit is pushed in the main branch_)
* Deploying the documentation of stable versions (_ran whenever a release is published_)
* Publishing the package to PyPi (_ran whenever a release is published_)

!!! note "Where to modify it ?"
You can modify the Github action for latest documentation deployment in `.github/workflows/mike_dev.yaml`.

You can modify the Github action for stable documentation deployment in `.github/workflows/mike_stable.yaml`.

You can modify the Github action for package publishing to PyPi in `.github/workflows/auto_pypi.yaml`.


### Others

Expand Down
10 changes: 10 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,13 @@ Head over to the [Features](features.md) page to see which file to remove.
## Enable Dependabot

From the Github website, on your repository page, you can enable [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates#enabling-or-disabling-dependabot-security-updates-for-an-individual-repository) by going to the `Settings` tab of your repository, then in the `Security & analysis` section you can enable `Dependabot alerts` and `Dependabot security updates`.


## Add your PyPi API token

The Github action that automatically publish your package to PyPi (see [Features](features.md#continuous-deployment)) requires your [PyPi API token](https://pypi.org/help/#apitoken).

You can store the API token in a [Github secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets).
To do this, go to the `Settings` tab of your Github repository, then go to the `Secrets` section, and click the button `New repository secret`.

Then set the name of the secret as `PYPI_API_TOKEN`, and put your API token in the value field.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

setuptools.setup(
name="pytere",
version="0.2.0.dev0",
version="0.2.0",
author="Nicolas REMOND",
author_email="[email protected]",
description="A Python Template Repository",
Expand Down