Skip to content

Commit

Permalink
Simplify PyPI publishing step in the GitHub Actions workflow.
Browse files Browse the repository at this point in the history
    - Removed condition check and echo statements after `uv publish` in `build.yml`.
    - Eliminated unnecessary `Check if published` step.
  • Loading branch information
jag-k committed Nov 18, 2024
1 parent 4a5910c commit 0820cbf
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 63 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,30 @@ jobs:

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install the project
run: uv sync --all-extras --dev
run: |
uv sync --all-extras --dev --frozen --no-editable
- name: Run linting
run: uv run pre-commit run --all-files
run: uv run --frozen --no-editable pre-commit run --all-files

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
git diff
uv build
uv publish && echo "published=1" >> "$GITHUB_ENV" || echo "published=0" >> "$GITHUB_ENV"
- name: Check if published
if: startsWith(github.ref, 'refs/tags/')
run: |
if [ "$published" = "1" ]; then
echo "Published to PyPI"
else
echo "Failed to publish to PyPI"
exit 1
fi
uv publish
- name: Make release with docset
uses: softprops/action-gh-release@v1
Expand Down
Loading

0 comments on commit 0820cbf

Please sign in to comment.