Skip to content

Commit f52b1d4

Browse files
committed
chore: update release script to modify version field in src/info.json
1 parent 4f32116 commit f52b1d4

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
echo "message=$(git tag -l --format='%(contents:subject)' ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT
2525
2626
- name: Change version
27-
run: sed -i -e "s/0\.1\.0/${{ steps.get_version.outputs.version-without-v }}/" src/info.json
27+
run: |
28+
OLD_VERSION=$(grep '"version":' src/info.json | awk -F\" '{print $4}')
29+
sed -i "s/$OLD_VERSION/${{ steps.get_version.outputs.version-without-v }}/" src/info.json
2830
2931
- name: Package plugin
3032
run: mkdir release && zip -j -r release/openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin ./src/*
@@ -33,7 +35,7 @@ jobs:
3335

3436
- name: Update appcast.json
3537
run: |
36-
python3 scripts/update_appcast.py ${{ steps.get_version.outputs.version-without-v }} '${{ steps.tag.outputs.message }}'
38+
python3 scripts/update_release.py ${{ steps.get_version.outputs.version-without-v }} '${{ steps.tag.outputs.message }}'
3739
3840
- name: Commit files
3941
run: |

scripts/update_appcast.py renamed to scripts/update_release.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ def update_appcast(version, desc):
2727
with open(appcast_file, 'w') as f:
2828
json.dump(appcast, f, ensure_ascii=False, indent=2)
2929

30+
def update_info_json(version):
31+
info_file = Path('src/info.json')
32+
with open(info_file, 'r') as f:
33+
info = json.load(f)
34+
info['version'] = version
35+
with open(info_file, 'w') as f:
36+
json.dump(info, f, ensure_ascii=False, indent=2)
3037

3138
if __name__ == '__main__':
3239
version = sys.argv[1]
3340
desc = sys.argv[2]
3441
update_appcast(version, desc)
42+
update_info_json(version)

src/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"identifier": "yetone.openai.translator",
3-
"version": "0.1.0",
3+
"version": "0.2.8",
44
"category": "translate",
55
"name": "OpenAI Translator",
66
"summary": "GPT powered translator",

0 commit comments

Comments
 (0)