Skip to content

Commit

Permalink
Auto-create pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans authored Nov 15, 2024
1 parent 509e63b commit 4d9b4ca
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,56 +88,56 @@ runs:
git config user.email ${{ inputs.git_committer_email }}
shell: bash

- name: check for deprecated features
- name: Check pyproject.toml for project migration
if: env.IS_GIT_BEHIND != 'true'
run: |
# if needed: auto-create a minimal pyproject.toml
if [[ ! -f pyproject.toml ]]; then
touch pyproject.toml
# TODO: update logic when https://github.com/WIPACrepo/wipac-dev-py-setup-action/issues/62
# add required fields
echo "# WIPACrepo/wipac-dev-py-setup-action@v4+ Migration Helper:" >> pyproject.toml
echo "" >> pyproject.toml
echo "# set these fields:" >> pyproject.toml
echo "[project]" >> pyproject.toml
echo "version = \"0.0.0\"" >> pyproject.toml
# add most likely needed fields
echo "dependencies = [] # leave empty if there are no dependencies" >> pyproject.toml
echo "" >> pyproject.toml
echo "# optional sections:" >> pyproject.toml
echo "" >> pyproject.toml
echo "# [project.optional-dependencies]" >> pyproject.toml
echo "# foo = []" >> pyproject.toml
echo "# bar = []" >> pyproject.toml
# commit, push, exit
msg="added pyproject.toml -- user needs to set values for auto-added fields"
git add .
git commit -m "<bot> $msg"
git push
echo $msg
echo "IS_GIT_BEHIND=true" >> $GITHUB_ENV
fi
# no setup.cfg allowed!
if [[ -f setup.cfg ]]; then
if [[ ! -f pyproject.toml ]]; then
# auto-create a minimal toml
# when this action runs on next commit, it will match the 'else' condition below
touch pyproject.toml
# TODO: update logic when https://github.com/WIPACrepo/wipac-dev-py-setup-action/issues/62
# add required fields
echo "# WIPACrepo/wipac-dev-py-setup-action@v4+ Migration Helper:" >> pyproject.toml
echo "" >> pyproject.toml
echo "# set these fields:" >> pyproject.toml
echo "[project]" >> pyproject.toml
echo "version = \"0.0.0\"" >> pyproject.toml
# add most likely needed fields
echo "dependencies = [] # leave empty if there are no dependencies" >> pyproject.toml
echo "" >> pyproject.toml
echo "# optional sections:" >> pyproject.toml
echo "" >> pyproject.toml
echo "# [project.optional-dependencies]" >> pyproject.toml
echo "# foo = []" >> pyproject.toml
echo "# bar = []" >> pyproject.toml
# commit, push, exit
msg="added pyproject.toml -- user needs to set values for auto-added fields"
git add .
git commit -m "<bot> $msg"
git push
echo $mgs
echo "IS_GIT_BEHIND=true" >> $GITHUB_ENV
else
echo " "
echo "WIPACrepo/wipac-dev-py-setup-action no longer supports 'setup.cfg'"
echo "Migration Steps:"
echo " 1. Look at 'pyproject.toml'--this action may have auto-added fields."
echo " Fill out any needed values."
echo " 2. Manually move attributes from setup.cfg's [wipac:cicd_setup_builder]"
echo " section to WIPACrepo/wipac-dev-py-setup-action's 'with' block."
echo " See https://github.com/WIPACrepo/wipac-dev-py-setup-action#inputs."
echo " 3. Migrate any non-autogenerated configuration to 'pyproject.toml'."
echo " 4. Delete 'setup.cfg'."
echo " 5. If used, update WIPACrepo/wipac-dev-py-versions-action to most"
echo " recent version."
echo " See https://github.com/WIPACrepo/wipac-dev-py-versions-action."
echo " 6. Push these changes!"
exit 1
fi
echo " "
echo "WIPACrepo/wipac-dev-py-setup-action no longer supports 'setup.cfg'"
echo "Migration Steps:"
echo " 1. Look at 'pyproject.toml'--this action may have auto-added fields."
echo " Fill out any needed values."
echo " 2. Manually move attributes from setup.cfg's [wipac:cicd_setup_builder]"
echo " section to WIPACrepo/wipac-dev-py-setup-action's 'with' block."
echo " See https://github.com/WIPACrepo/wipac-dev-py-setup-action#inputs."
echo " 3. Migrate any non-autogenerated configuration to 'pyproject.toml'."
echo " 4. Delete 'setup.cfg'."
echo " 5. If used, update WIPACrepo/wipac-dev-py-versions-action to most"
echo " recent version."
echo " See https://github.com/WIPACrepo/wipac-dev-py-versions-action."
echo " 6. Push these changes!"
exit 1
fi
shell: bash


- name: Build pyproject.toml + README.md (and commit)
if: env.IS_GIT_BEHIND != 'true'
run: |
Expand Down

0 comments on commit 4d9b4ca

Please sign in to comment.