Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
feat: improve build python package workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo committed Jan 23, 2024
1 parent 375cfd1 commit 85766f3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 40 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ jobs:
build:
name: Build the python package
runs-on: ubuntu-latest
permissions:
# This permission is needed for private repositories.
# contents: read
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v3
Expand All @@ -30,5 +25,7 @@ jobs:
- name: Build Package 🍟
run: scripts/build_distribution.sh
- name: Upload package artifact
# TODO: Delete option `--repository testpypi` once we finish the testing process
run: pdm publish --no-build --repository testpypi
uses: actions/upload-artifact@v3
with:
name: python-package
path: dist
68 changes: 35 additions & 33 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,36 +178,38 @@ jobs:
# image-version: ${{ needs.build_quickstart_docker_image.outputs.version }}
# secrets: inherit

# This job will upload a Python Package using Twine when a release is created
# For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# publish_release:
# name: Publish Release
# runs-on: ubuntu-latest
# if: ${{ github.event_name == 'release' }}
# needs:
# - build_quickstart_docker_image
# defaults:
# run:
# shell: bash -l {0}
# steps:
# - name: Checkout Code 🛎
# uses: actions/checkout@v3
# - name: Download python package
# uses: actions/download-artifact@v2
# with:
# name: python-package
# path: dist
# - name: Publish Package to TestPyPI 🥪
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.AR_TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# - name: Test Installing 🍿
# run: pip install --index-url https://test.pypi.org/simple --no-deps argilla==${GITHUB_REF#refs/*/v}
# - name: Publish Package to PyPI 🥩
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.AR_PYPI_API_TOKEN }}
# This job will publish argilla-server python package into PyPI repository
publish_release:
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
needs:
- build_quickstart_docker_image
permissions:
# This permission is needed for private repositories.
# contents: read
# IMPORTANT: this permission is mandatory for trusted publishing on PyPI
id-token: write
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Download python package
uses: actions/download-artifact@v2
with:
name: python-package
path: dist
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
cache: true
- name: Publish Package to PyPI test environment 🥪
run: pdm publish --no-build --repository testpypi
- name: Test Installing 🍿
run: pip install --index-url https://test.pypi.org/simple --no-deps argilla-server==${GITHUB_REF#refs/*/v}
- name: Publish Package to PyPI 🥩
run: pdm publish --no-build

0 comments on commit 85766f3

Please sign in to comment.