File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Replace Version Text-Safe
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ replace-version :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
14+
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v3
18+ with :
19+ persist-credentials : false
20+
21+ - name : Setup Git identity
22+ run : |
23+ git config user.name "github-actions[bot]"
24+ git config user.email "github-actions[bot]@users.noreply.github.com"
25+
26+ - name : Replace all versions 0.0.0 → 2.2.0 with 2.2.1
27+ run : |
28+ echo "Normalizing versions to 2.2.1..."
29+ find . -type f ! -path "*/.git/*" ! -path "*/.github/*" -print0 | while IFS= read -r -d '' file; do
30+ if file --mime "$file" | grep -q 'charset='; then
31+ perl -pi -e 's/(^|[^0-9])(?:[0-1]?\d|2)\.(?:\d{1,2})\.(?:\d{1,2})([^0-9]|$)/${1}2.2.1${2}/g' "$file"
32+ fi
33+ done
34+
35+ - name : Commit & push changes
36+ run : |
37+ git add .
38+ git diff --cached --quiet || git commit -m "Version normalization → 2.2.1 [skip ci]"
39+ git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:${GITHUB_REF#refs/heads/}
40+
You can’t perform that action at this time.
0 commit comments