-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f8fd17
commit c130b81
Showing
1 changed file
with
40 additions
and
22 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 |
---|---|---|
|
@@ -3,57 +3,75 @@ name: Update PDM Lock Files | |
on: | ||
push: | ||
paths: | ||
- 'unstract/**/pyproject.toml' | ||
- '**/pyproject.toml' # Watch for changes in any pyproject.toml file | ||
|
||
|
||
jobs: | ||
update-pdm-lock: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
service: [backend, prompt-service, platform-service] | ||
# service: [backend, prompt-service, platform-service] | ||
service: [backend, prompt-service] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9.0' | ||
python-version: '3.9' | ||
|
||
- name: Install PDM | ||
run: python -m pip install pdm | ||
|
||
- name: Update pdm.lock for ${{ matrix.service }} | ||
run: | | ||
cd unstract/${{ matrix.service }} | ||
pdm venv create -w virtualenv --with-pip | ||
source .venv/bin/activate | ||
pdm lock | ||
|
||
- name: Update pdm.lock for root directory | ||
- name: Create virtual environment | ||
run: pdm venv create -w virtualenv --with-pip | ||
|
||
- name: Update pdm.lock for ${{ matrix.service }} | ||
run: | | ||
cd unstract | ||
cd ${{ matrix.service }} | ||
pdm venv create -w virtualenv --with-pip | ||
source .venv/bin/activate | ||
pdm lock | ||
- name: Commit changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
# Commit changes for each service directory | ||
cd unstract/${{ matrix.service }} | ||
git add pdm.lock | ||
git commit -m "Update pdm.lock for ${{ matrix.service }}" | ||
# Commit changes for root directory | ||
cd .. | ||
# Debugging output | ||
echo "Listing matrix dir name:"; pwd | ||
echo "Listing files in matrix directory:"; ls -al | grep pdm.lock | ||
- name: Update pdm.lock for root | ||
run: | | ||
source .venv/bin/activate | ||
pdm lock | ||
git add pdm.lock | ||
git commit -m "Update pdm.lock for root directory" | ||
# Debugging output | ||
echo "Listing root dir name:"; pwd | ||
echo "Listing files in root directory:"; ls -al | grep pdm.lock | ||
- name: Activate virtual environment and install pre-commit | ||
run: | | ||
source .venv/bin/activate | ||
python -m pip install --upgrade pip | ||
pip install pre-commit~=3.6.2 | ||
- name: Run pre-commit hooks and commit pdm lock changes | ||
run: | | ||
source .venv/bin/activate | ||
git add .pre-commit-config.yaml | ||
pre-commit run | ||
git commit -m "Adding pdm.lock for root directory" | ||
- name: Push changes | ||
run: git push | ||
run: | | ||
echo "yes" | git push [email protected]:${{ github.repository }} HEAD:${{ github.ref }} | ||
if: success() |