Skip to content

Commit 5da6f1b

Browse files
authored
Generate updates xml on prerelease build (#4275)
1 parent f4a397f commit 5da6f1b

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import json
2+
import re
3+
import sys
4+
5+
if __name__ == '__main__':
6+
arg = sys.argv[1:][0]
7+
if arg == '-':
8+
data = json.load(sys.stdin)
9+
else:
10+
with open(arg) as f:
11+
data = json.load(f)
12+
13+
xml = ['<?xml version="1.0" encoding="UTF-8"?>', '<plugins>']
14+
15+
buildRegex = r'.*(\d{3}).zip'
16+
for asset in data['assets']:
17+
name = asset['name']
18+
if ('plugin-amazonq' in name):
19+
plugin = 'amazon.q'
20+
elif ('plugin-core' in name):
21+
plugin = 'aws.toolkit.core'
22+
else:
23+
plugin = 'aws.toolkit'
24+
build = re.match(buildRegex, name).group(1)
25+
26+
xml.append(f'''<plugin id="{plugin}" url="{asset['url']}" version="999">
27+
<idea-version since-build="{build}" until-build="{build}.*"/>
28+
</plugin>''')
29+
30+
xml.append('</plugins>')
31+
32+
print('\n'.join(xml))

.github/workflows/prerelease.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,17 @@ jobs:
201201
- name: Publish to GitHub Releases
202202
run: |
203203
envsubst < "$GITHUB_WORKSPACE/.github/workflows/prerelease_notes.md" > "$RUNNER_TEMP/prerelease_notes.md"
204-
gh release create $TAG_NAME --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-toolkit-*/*.zip
204+
gh release create "$TAG_NAME" --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-toolkit-*/*.zip
205205
- name: Publish core
206206
run: |
207-
gh release upload $TAG_NAME plugin-core-*/*.zip
207+
gh release upload "$TAG_NAME" plugin-core-*/*.zip
208208
- name: Publish Q
209209
run: |
210-
gh release upload $TAG_NAME plugin-amazonq-*/*.zip
210+
gh release upload "$TAG_NAME" plugin-amazonq-*/*.zip
211211
- name: Publish Toolkit Standalone
212212
run: |
213-
gh release upload $TAG_NAME plugin-standalone-*/*.zip
213+
gh release upload "$TAG_NAME" plugin-standalone-*/*.zip
214+
- name: Publish XML manifest
215+
run: |
216+
gh release view "$TAG_NAME" --repo aws/aws-toolkit-jetbrains --json assets | python3 "$GITHUB_WORKSPACE/.github/workflows/generateUpdatesXml.py" - > updatePlugins.xml
217+
gh release upload "$TAG_NAME" updatePlugins.xml

0 commit comments

Comments
 (0)