check if pyproject has changed before publishing #1
Workflow file for this run
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 | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
pypi_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check if `pyproject.toml` has changed | |
id: check_file_changes | |
run: | | |
if git diff --name-only HEAD^ HEAD | grep -q 'pyproject.toml'; then | |
echo "changed=true" >> $GITHUB_ENV | |
else | |
echo "changed=false" >> $GITHUB_ENV | |
- name: Install UV | |
if: env.changed == 'true' | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Source Cargo Environment | |
if: env.changed == 'true' | |
run: source $HOME/.cargo/env | |
- name: Build with UV | |
if: env.changed == 'true' | |
run: uvx --from build pyproject-build --installer uv | |
- name: No Deploy Needed | |
if: env.changed == 'false' | |
run: echo "No deploy needed" |