Skip to content

Commit dc0a69f

Browse files
Create tmp.yml
1 parent fd2c63b commit dc0a69f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/tmp.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
with:
18+
persist-credentials: false
19+
20+
- name: Setup Git identity
21+
run: |
22+
git config user.name "github-actions[bot]"
23+
git config user.email "github-actions[bot]@users.noreply.github.com"
24+
25+
- name: Ultra-precise text-only replacement
26+
run: |
27+
echo "Replacing all 3.0.0 and 2.0.1 → 2.0.2 in text/code files only..."
28+
find . -type f ! -path "*/.git/*" ! -path "*/.github/*" -print0 | while IFS= read -r -d '' file; do
29+
if file --mime "$file" | grep -q 'charset='; then
30+
perl -pi -e 's/(^|[^0-9])3\.0\.0([^0-9]|$)/${1}2.0.2${2}/g' "$file"
31+
perl -pi -e 's/(^|[^0-9])2\.0\.1([^0-9]|$)/${1}2.0.2${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 "Text-safe update: 3.0.0, 2.0.1 → 2.0.2 [skip ci]"
39+
git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:${GITHUB_REF#refs/heads/}
40+

0 commit comments

Comments
 (0)