-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for release + version in code
- Loading branch information
Showing
3 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: PyPI release | ||
|
||
# Make a PyPI release. This action: | ||
# - builds the release files | ||
# - checks the tag version matches the source version | ||
# - releases on PyPI using the action | ||
# | ||
# The first time, you have to upload the release yourself to get the | ||
# API key, to add to gh-secrets. | ||
# | ||
# I upload it with: | ||
# python setup.py sdist bdist_wheel | ||
# twine upload dist/* | ||
# | ||
# To configure the secrets, see steps here: | ||
# https://github.com/pypa/gh-action-pypi-publish | ||
# secret name= pypi_password | ||
|
||
|
||
# If MOD_NAME not defined, infer it from the current directory. If | ||
# inferred from the directory, '-' is replaced with '_'. This is used | ||
# when checking the version name. | ||
#env: | ||
# MOD_NAME: numpy | ||
|
||
on: | ||
# For Github release-based publishing | ||
#release: | ||
# types: [published] | ||
# For tag-based (instead of Github-specific release-based): | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
#with: | ||
# python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-dev.txt | ||
pip install twine wheel | ||
- name: Build | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
# Verify that the git tag has the same version as the python | ||
# project version. | ||
- uses: rkdarst/action-verify-python-version@main | ||
|
||
- uses: actions/upload-artifact@master | ||
with: | ||
name: dist-directory | ||
path: dist/ | ||
|
||
|
||
upload: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
permissions: | ||
id-token: write # for trusted publishing | ||
steps: | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: dist-directory | ||
path: dist/ | ||
|
||
- name: Publish on PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
#with: | ||
#user: __token__ | ||
#password: ${{ secrets.pypi_password }} | ||
#repository_url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
from __future__ import print_function | ||
|
||
__version__ = '0.1.3' | ||
|
||
from .substitution import * | ||
from .util import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters