Skip to content

Commit 113b0b5

Browse files
committed
chore(workflow): switch to ncu
1 parent e49dff2 commit 113b0b5

1 file changed

Lines changed: 20 additions & 46 deletions

File tree

.github/workflows/check-updates.yml

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,64 +21,38 @@ jobs:
2121
cache: 'npm'
2222

2323
- name: Install dependencies
24-
run: npm ci
24+
run: npm install
2525

26-
- name: Check for ExifTool updates
26+
- name: Update dependencies
2727
id: update
2828
run: |
29-
# Get current versions from package.json
30-
CURRENT_PL_VERSION=$(node -p "require('./package.json').optionalDependencies['exiftool-vendored.pl']")
31-
CURRENT_EXE_VERSION=$(node -p "require('./package.json').optionalDependencies['exiftool-vendored.exe']")
32-
33-
echo "Current exiftool-vendored.pl version: $CURRENT_PL_VERSION"
34-
echo "Current exiftool-vendored.exe version: $CURRENT_EXE_VERSION"
35-
36-
# Check latest versions from npm
37-
LATEST_PL_VERSION=$(npm view exiftool-vendored.pl version)
38-
LATEST_EXE_VERSION=$(npm view exiftool-vendored.exe version)
29+
# Capture current package.json content
30+
cp package.json package.json.backup
3931
40-
echo "Latest exiftool-vendored.pl version: $LATEST_PL_VERSION"
41-
echo "Latest exiftool-vendored.exe version: $LATEST_EXE_VERSION"
42-
43-
# Check if updates are available
44-
UPDATES_AVAILABLE=false
45-
46-
if [ "$CURRENT_PL_VERSION" != "$LATEST_PL_VERSION" ]; then
47-
echo "exiftool-vendored.pl update available: $CURRENT_PL_VERSION -> $LATEST_PL_VERSION"
48-
UPDATES_AVAILABLE=true
49-
fi
32+
# Run npm-check-updates to update all dependencies
33+
npx ncu -u
5034
51-
if [ "$CURRENT_EXE_VERSION" != "$LATEST_EXE_VERSION" ]; then
52-
echo "exiftool-vendored.exe update available: $CURRENT_EXE_VERSION -> $LATEST_EXE_VERSION"
53-
UPDATES_AVAILABLE=true
54-
fi
55-
56-
if [ "$UPDATES_AVAILABLE" = true ]; then
35+
# Check if package.json was modified
36+
if ! diff -q package.json package.json.backup > /dev/null; then
5737
echo "changed=true" >> $GITHUB_OUTPUT
58-
echo "pl_version=$LATEST_PL_VERSION" >> $GITHUB_OUTPUT
59-
echo "exe_version=$LATEST_EXE_VERSION" >> $GITHUB_OUTPUT
38+
echo "Dependencies updated"
6039
61-
# Create multiline update summary using heredoc
40+
# Generate summary of changes
6241
{
6342
echo 'update_summary<<EOF'
64-
if [ "$CURRENT_PL_VERSION" != "$LATEST_PL_VERSION" ]; then
65-
echo "- exiftool-vendored.pl: $CURRENT_PL_VERSION → $LATEST_PL_VERSION"
66-
fi
67-
if [ "$CURRENT_EXE_VERSION" != "$LATEST_EXE_VERSION" ]; then
68-
echo "- exiftool-vendored.exe: $CURRENT_EXE_VERSION → $LATEST_EXE_VERSION"
69-
fi
43+
echo "Updated dependencies to their latest versions:"
44+
echo ""
45+
# Show the diff in a readable format
46+
diff -u package.json.backup package.json | grep "^[-+]" | grep -E "(exiftool-vendored|dependencies)" | sed 's/^-/ - /' | sed 's/^+/ + /'
7047
echo 'EOF'
7148
} >> $GITHUB_OUTPUT
72-
73-
# Update package.json with new versions
74-
npm pkg set optionalDependencies.exiftool-vendored.pl=$LATEST_PL_VERSION
75-
npm pkg set optionalDependencies.exiftool-vendored.exe=$LATEST_EXE_VERSION
76-
77-
echo "Updated package.json with new versions"
7849
else
7950
echo "changed=false" >> $GITHUB_OUTPUT
8051
echo "No updates available"
8152
fi
53+
54+
# Clean up backup
55+
rm -f package.json.backup
8256
8357
- name: Install updated dependencies
8458
if: steps.update.outputs.changed == 'true'
@@ -94,10 +68,10 @@ jobs:
9468
with:
9569
token: ${{ secrets.GITHUB_TOKEN }}
9670
sign-commits: true
97-
commit-message: "chore(deps): update ExifTool dependencies"
98-
title: "Update ExifTool dependencies"
71+
commit-message: "chore(deps): update dependencies"
72+
title: "Update dependencies"
9973
body: |
100-
Updates ExifTool optional dependencies to their latest versions.
74+
Updates dependencies to their latest versions.
10175
10276
This is an automated update created by the check-updates workflow.
10377

0 commit comments

Comments
 (0)