forked from thoth-station/micropipenv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflow for automatic update of supported pip
- Loading branch information
1 parent
bfb04b2
commit da799ad
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Check and update supported pip | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Runs daily at midnight | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
jobs: | ||
check-pip-update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Run the update script | ||
run: | | ||
.github/workflows/update_supported_pip.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Get the latest pip release | ||
python3 -m venv venv | ||
./venv/bin/pip install --upgrade pip | ||
PIP_VERSION=$(./venv/bin/pip --version | awk '{print $2}') | ||
|
||
# Replace it in the micropipenv.py | ||
sed -i "/_SUPPORTED_PIP_STR/s/<=[^\"]*\"/<=$PIP_VERSION\"/" micropipenv.py | ||
|
||
# Is there any change to propose? | ||
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then | ||
echo "New pip available" | ||
|
||
# Commit the change | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Lumír Balhar" | ||
git checkout -b update-pip-$PIP_VERSION | ||
git add micropipenv.py | ||
git commit -m "Update supported pip to $PIP_VERSION" | ||
GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' git push origin update-pip-$PIP_VERSION | ||
|
||
# Create a pull request using GitHub CLI | ||
gh pr create --title "Update supported pip to $PIP_VERSION" --body "SSIA" | ||
|
||
else | ||
echo "There is nothing to be done…" | ||
fi |