Try to install CLI in action #2
This file contains hidden or 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: Detect Changed Folders on Merge to Main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get widgets with changes | |
id: changed | |
run: | | |
folders=$(git diff --name-only HEAD^ HEAD | cut -d/ -f1 | sort -u) | |
echo "changed_folders<<EOF" >> $GITHUB_OUTPUT | |
echo "$folders" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Install CLI | |
run: npm i -g @vev/cli | |
- name: Deploy widgets | |
run: | | |
for folder in ${{ steps.changed.outputs.changed_folders }}; do | |
if [ -f "$folder/vev.json" ]; then | |
echo "Deploying $folder" | |
(cd "$folder" && vev deploy -m "${{ github.sha }}") | |
else | |
echo "Skipping $folder (no vev.json)" | |
fi | |
done | |