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 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
61 changes: 61 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: PyPI release
on:
workflow_dispatch:

jobs:
testing:
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
run: |
pip install -i https://testpypi.python.org/pypi --extra-index-url https://pypi.org/simple datatrove[testing]
python -m nltk.downloader punkt
make test

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/v${{ steps.get_tag_name.outputs.TAG_NAME }}',
sha: context.sha
})

- name: Publish to PyPI
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/* --repository=pypi
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml → .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Test & Check Code Quality

on:
pull_request:
Expand All @@ -7,6 +7,7 @@ on:
push:
branches:
- main
workflow_call:

jobs:
check_code_quality:
Expand Down
Loading