Skip to content

Commit

Permalink
Generate updates xml on prerelease build (#4275)
Browse files Browse the repository at this point in the history
  • Loading branch information
rli authored Apr 15, 2024
1 parent f4a397f commit 5da6f1b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/generateUpdatesXml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import json
import re
import sys

if __name__ == '__main__':
arg = sys.argv[1:][0]
if arg == '-':
data = json.load(sys.stdin)
else:
with open(arg) as f:
data = json.load(f)

xml = ['<?xml version="1.0" encoding="UTF-8"?>', '<plugins>']

buildRegex = r'.*(\d{3}).zip'
for asset in data['assets']:
name = asset['name']
if ('plugin-amazonq' in name):
plugin = 'amazon.q'
elif ('plugin-core' in name):
plugin = 'aws.toolkit.core'
else:
plugin = 'aws.toolkit'
build = re.match(buildRegex, name).group(1)

xml.append(f'''<plugin id="{plugin}" url="{asset['url']}" version="999">
<idea-version since-build="{build}" until-build="{build}.*"/>
</plugin>''')

xml.append('</plugins>')

print('\n'.join(xml))
12 changes: 8 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,17 @@ jobs:
- name: Publish to GitHub Releases
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/prerelease_notes.md" > "$RUNNER_TEMP/prerelease_notes.md"
gh release create $TAG_NAME --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-toolkit-*/*.zip
gh release create "$TAG_NAME" --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-toolkit-*/*.zip
- name: Publish core
run: |
gh release upload $TAG_NAME plugin-core-*/*.zip
gh release upload "$TAG_NAME" plugin-core-*/*.zip
- name: Publish Q
run: |
gh release upload $TAG_NAME plugin-amazonq-*/*.zip
gh release upload "$TAG_NAME" plugin-amazonq-*/*.zip
- name: Publish Toolkit Standalone
run: |
gh release upload $TAG_NAME plugin-standalone-*/*.zip
gh release upload "$TAG_NAME" plugin-standalone-*/*.zip
- name: Publish XML manifest
run: |
gh release view "$TAG_NAME" --repo aws/aws-toolkit-jetbrains --json assets | python3 "$GITHUB_WORKSPACE/.github/workflows/generateUpdatesXml.py" - > updatePlugins.xml
gh release upload "$TAG_NAME" updatePlugins.xml

0 comments on commit 5da6f1b

Please sign in to comment.