Skip to content

Commit

Permalink
chore: update release script to modify version field in src/info.json
Browse files Browse the repository at this point in the history
  • Loading branch information
liby committed Apr 6, 2023
1 parent 4f32116 commit f52b1d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
echo "message=$(git tag -l --format='%(contents:subject)' ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT
- name: Change version
run: sed -i -e "s/0\.1\.0/${{ steps.get_version.outputs.version-without-v }}/" src/info.json
run: |
OLD_VERSION=$(grep '"version":' src/info.json | awk -F\" '{print $4}')
sed -i "s/$OLD_VERSION/${{ steps.get_version.outputs.version-without-v }}/" src/info.json
- name: Package plugin
run: mkdir release && zip -j -r release/openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin ./src/*
Expand All @@ -33,7 +35,7 @@ jobs:

- name: Update appcast.json
run: |
python3 scripts/update_appcast.py ${{ steps.get_version.outputs.version-without-v }} '${{ steps.tag.outputs.message }}'
python3 scripts/update_release.py ${{ steps.get_version.outputs.version-without-v }} '${{ steps.tag.outputs.message }}'
- name: Commit files
run: |
Expand Down
8 changes: 8 additions & 0 deletions scripts/update_appcast.py → scripts/update_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ def update_appcast(version, desc):
with open(appcast_file, 'w') as f:
json.dump(appcast, f, ensure_ascii=False, indent=2)

def update_info_json(version):
info_file = Path('src/info.json')
with open(info_file, 'r') as f:
info = json.load(f)
info['version'] = version
with open(info_file, 'w') as f:
json.dump(info, f, ensure_ascii=False, indent=2)

if __name__ == '__main__':
version = sys.argv[1]
desc = sys.argv[2]
update_appcast(version, desc)
update_info_json(version)
2 changes: 1 addition & 1 deletion src/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"identifier": "yetone.openai.translator",
"version": "0.1.0",
"version": "0.2.8",
"category": "translate",
"name": "OpenAI Translator",
"summary": "GPT powered translator",
Expand Down

0 comments on commit f52b1d4

Please sign in to comment.