ci: prune configuration (#365) #489
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
name: PyPI Release | |
# https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: # Trigger the workflow on push or pull request, but only for the main branch | |
push: | |
branches: [main] | |
release: | |
types: [published] | |
pull_request: | |
branches: [main] | |
paths: | |
- ".github/workflows/release-pypi.yml" | |
# based on https://github.com/pypa/gh-action-pypi-publish | |
jobs: | |
build-package: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Pull reusable 🤖 actions️ | |
uses: actions/checkout@v4 | |
with: | |
ref: v0.11.3.post0 | |
path: .cicd | |
repository: Lightning-AI/utilities | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Prepare build env. | |
run: pip install -r ./.cicd/requirements/gha-package.txt | |
- name: Create 📦 package | |
uses: ./.cicd/.github/actions/pkg-create | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-packages-${{ github.sha }} | |
path: dist | |
publish-package: | |
needs: build-package | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pypi-packages-${{ github.sha }} | |
path: dist | |
- run: ls -lh dist/ | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |