diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 631025b..6a565fb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,51 +1,50 @@ name: Publish Python Package on: - release: - types: [created] + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + inputs: + tag: + description: "Tag to publish" + required: true permissions: + actions: read + checks: none contents: read + deployments: none + discussions: none + id-token: write + issues: none + packages: read + pages: none + pull-requests: read + repository-projects: none + security-events: none + statuses: none jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: pip - cache-dependency-path: '**/setup.py' - - name: Install dependencies - run: | - pip install -e '.[test]' - - name: Run tests - run: | - pytest deploy: runs-on: ubuntu-latest - needs: [test] steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} + fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.12" cache: pip - cache-dependency-path: '**/setup.py' - - name: Install dependencies + - name: Install dependencies & Build run: | - pip install setuptools wheel twine build - - name: Publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - python -m build - twine upload dist/* + python -m pip install setuptools wheel build + python -m build . + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.RAPIDSAI_PYPI_TOKEN }}