Skip to content

Commit

Permalink
feat(ci): get tag message
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Mar 2, 2023
1 parent b75f8de commit b1ac829
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
id: get_version
uses: battila7/get-version-action@v2

- name: Get tag message
id: tag
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
echo "message=$(git tag -l --format='%(contents:subject)' v0.1.0)" >> $GITHUB_OUTPUT
- name: Change version
run: sed -i -e "s/0\.1\.0/${{ steps.get_version.outputs.version-without-v }}/" src/info.json

Expand All @@ -27,7 +33,7 @@ jobs:

- name: Update appcast.json
run: |
python3 scripts/update_appcast.py ${{ steps.get_version.outputs.version-without-v }}
python3 scripts/update_appcast.py ${{ steps.get_version.outputs.version-without-v }} '${{ steps.tag.outputs.message }}'
- name: Commit files
run: |
Expand All @@ -49,4 +55,4 @@ jobs:
asset_name: openai-translator-${{ steps.get_version.outputs.version-without-v }}.bobplugin
tag: ${{ github.ref }}
overwrite: true
body: "Release OpenAI Translator Bob plugin ${{ steps.get_version.outputs.version }}!"
body: ${{ steps.tag.outputs.message }}
7 changes: 4 additions & 3 deletions scripts/update_appcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from pathlib import Path


def update_appcast(version):
def update_appcast(version, desc):
release_file = Path(f'release/openai-translator-{version}.bobplugin')
assert release_file.is_file(), 'Release file not exist'
with open(release_file, 'rb') as f:
c = f.read()
file_hash = hashlib.sha256(c).hexdigest()
version_info = {
'version': version,
'desc': f'https://github.com/yetone/bob-plugin-openai-translator/releases/tag/v{version}',
'desc': desc,
'sha256': file_hash,
'url': f'https://github.com/yetone/bob-plugin-openai-translator/releases/download/v{version}/{release_file.name}',
'minBobVersion': '0.5.0'
Expand All @@ -30,4 +30,5 @@ def update_appcast(version):

if __name__ == '__main__':
version = sys.argv[1]
update_appcast(version)
desc = sys.argv[2]
update_appcast(version, desc)

0 comments on commit b1ac829

Please sign in to comment.