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

Pypi Publish Action #159

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
workflow_call:

jobs:
check_code_quality:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PyPI release
on:
workflow_dispatch:

jobs:
ci:
hynky1999 marked this conversation as resolved.
Show resolved Hide resolved
uses: ./.github/workflows/ci.yml
release:
needs: ci
runs-on: ubuntu-latest
env:
TWINE_USERNAME: __token__

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install -U twine build

- name: Build the dist files
run: python -m build .

- name: Publish to the test PyPI
env:
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: twine upload dist/* --repository=testpypi

- name: Test installing from test PyPI and running tests
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
hynky1999 marked this conversation as resolved.
Show resolved Hide resolved
run: |
pip install -i https://testpypi.python.org/pypi --extra-index-url https://pypi.org/simple datatrove[testing]
python -m nltk.downloader punkt

guipenedo marked this conversation as resolved.
Show resolved Hide resolved
- name: Get tag name
id: get_tag_name
run: |
echo TAG_NAME=$(grep '^version' pyproject.toml | head -1 | cut -d '"' -f 2) >> $GITHUB_OUTPUT

- name: Tag the release
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.get_tag_name.outputs.TAG_NAME }}',
guipenedo marked this conversation as resolved.
Show resolved Hide resolved
sha: context.sha
})


- name: Publish to PyPI
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/* --repository=pypi
Loading