-
Notifications
You must be signed in to change notification settings - Fork 10
46 lines (36 loc) · 1.35 KB
/
increment_versions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Increment Package Versions
on:
workflow_dispatch: # Manual trigger
jobs:
increment-version:
runs-on: ubuntu-latest
permissions:
contents: write # Allow write access to repository contents
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install jq
run: sudo apt-get install jq
- name: Increment Version
run: |
PACKAGE_FILES=("package.json" "libs/react/package.json" "libs/vue/package.json" "libs/svelte/package.json")
for file in "${PACKAGE_FILES[@]}"; do
echo "Updating version in $file"
CURRENT_VERSION=$(jq -r '.version' "$file")
NEW_VERSION=$(node -p "v='$CURRENT_VERSION'.split('.'); v[2]++; v.join('.')")
echo "Incrementing version: $CURRENT_VERSION -> $NEW_VERSION"
jq ".version=\"$NEW_VERSION\"" "$file" > tmp.json && mv tmp.json "$file"
done
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add .
git commit -m "Incremented package.json versions"
git push