-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (32 loc) · 1.14 KB
/
update_meta.yml
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
name: Update version in meta.json
permissions:
contents: write
on:
release:
types: [published]
jobs:
replace-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
- name: Replace VERSION_HERE in meta.json
run: |
echo "Replacing VERSION_HERE in meta.json..."
sed -i "s/VERSION_HERE/$(echo "$GITHUB_REF_NAME")/g" meta_template.json
mv meta_template.json meta.json
- name: Replace version in mod.txt
run: |
echo "Replacing version in mod.txt"
perl -pe 's/((?<="version" : ")|(?<="version" :")|(?<="version":")).+(?=")/"$GITHUB_REF_NAME"/g' mod.txt > new_mod.txt
mv new_mod.txt mod.txt
- name: Push changes to meta.json
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git add meta.json
git add mod.txt
git commit -m "Updated version tag in meta.json and mod.txt"
git push