@@ -67,14 +67,53 @@ jobs:
6767 --channel "${{ steps.resolve_channel.outputs.channel }}" \
6868 --output-dir dist/catalog-source
6969
70+ # ── legacy media assets (logos + screenshots, same as old media.yml) ──
71+
72+ - name : Download legacy logos from R2
73+ env :
74+ AWS_ACCESS_KEY_ID : ${{ secrets.CLOUDFLARE_R2_SECRET_ID }}
75+ AWS_SECRET_ACCESS_KEY : ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
76+ AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
77+ run : |
78+ mkdir -p dist/catalog-source/logos
79+ aws s3 sync \
80+ s3://libs/Websoft9/logo/product \
81+ dist/catalog-source/logos \
82+ --endpoint-url "$AWS_ENDPOINT_URL" || echo "Warning: logo sync failed (non-blocking)"
83+
84+ - name : Download legacy screenshots from Contentful
85+ run : |
86+ mkdir -p dist/catalog-source/screenshots
87+ for f in dist/catalog-source/product_*.json; do
88+ [ -f "$f" ] && python3 -c "
89+ import json, sys, urllib.request, os
90+ with open('$f') as fh :
91+ data = json.load(fh)
92+ urls = set()
93+ for item in data :
94+ for s in item.get('screenshots', []) :
95+ u = s.get('value') or s.get('imageurl')
96+ if u : urls.add(u)
97+ for u in sorted(urls) :
98+ try :
99+ name = u.rsplit('/', 1)[-1].split('?')[0]
100+ if '.' not in name : name = f'{hash(u) & 0xFFFFFFFFFFFF:012x}.png'
101+ path = os.path.join('dist/catalog-source/screenshots', name)
102+ if not os.path.exists(path) :
103+ urllib.request.urlretrieve(u, path)
104+ except Exception as e :
105+ print(f'Warning : screenshot {u}: {e}', file=sys.stderr)
106+ "
107+ done
108+
70109 - name: Check if first v2 publish (R2 apps/ prefix empty)
71110 id: check_seed
72111 env:
73112 AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_SECRET_ID }}
74113 AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
75114 AWS_ENDPOINT_URL: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
76115 run: |
77- count=$(aws s3 ls "s3://artifact/websoft9/v2/ ${{ steps.resolve_channel.outputs.channel }}/appstore /library/apps/" --recursive --endpoint-url "$AWS_ENDPOINT_URL" 2>/dev/null | wc -l)
116+ count=$(aws s3 ls " s3://artifact/appstore/ ${{ steps.resolve_channel.outputs.channel }}/library/apps/" --recursive --endpoint-url "$AWS_ENDPOINT_URL" 2>/dev/null | wc -l)
78117 if [ "$count" -eq 0 ]; then
79118 echo "R2 apps/ prefix is empty — first publish, will seed all app packages"
80119 echo "seed=true" >> "$GITHUB_OUTPUT"
@@ -111,8 +150,8 @@ jobs:
111150 AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
112151 run : |
113152 aws s3 sync \
114- dist/appstore-publish/v2 /${{ steps.resolve_channel.outputs.channel }}/appstore /catalog \
115- s3://artifact/websoft9/v2/ ${{ steps.resolve_channel.outputs.channel }}/appstore /catalog \
153+ dist/appstore-publish/appstore /${{ steps.resolve_channel.outputs.channel }}/catalog \
154+ s3://artifact/appstore/ ${{ steps.resolve_channel.outputs.channel }}/catalog \
116155 --endpoint-url "$AWS_ENDPOINT_URL"
117156
118157 - name : Upload v2 library metadata to Cloudflare R2
@@ -122,8 +161,8 @@ jobs:
122161 AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
123162 run : |
124163 aws s3 sync \
125- dist/appstore-publish/v2 /${{ steps.resolve_channel.outputs.channel }}/appstore /library \
126- s3://artifact/websoft9/v2/ ${{ steps.resolve_channel.outputs.channel }}/appstore /library \
164+ dist/appstore-publish/appstore /${{ steps.resolve_channel.outputs.channel }}/library \
165+ s3://artifact/appstore/ ${{ steps.resolve_channel.outputs.channel }}/library \
127166 --exclude "apps/*" \
128167 --endpoint-url "$AWS_ENDPOINT_URL"
129168
@@ -133,10 +172,10 @@ jobs:
133172 AWS_SECRET_ACCESS_KEY : ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
134173 AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
135174 run : |
136- if [ -d "dist/appstore-publish/v2 /${{ steps.resolve_channel.outputs.channel }}/appstore /library/apps" ]; then
175+ if [ -d "dist/appstore-publish/appstore /${{ steps.resolve_channel.outputs.channel }}/library/apps" ]; then
137176 aws s3 cp --recursive \
138- dist/appstore-publish/v2 /${{ steps.resolve_channel.outputs.channel }}/appstore /library/apps \
139- s3://artifact/websoft9/v2/ ${{ steps.resolve_channel.outputs.channel }}/appstore /library/apps \
177+ dist/appstore-publish/appstore /${{ steps.resolve_channel.outputs.channel }}/library/apps \
178+ s3://artifact/appstore/ ${{ steps.resolve_channel.outputs.channel }}/library/apps \
140179 --endpoint-url "$AWS_ENDPOINT_URL"
141180 fi
142181
@@ -147,6 +186,86 @@ jobs:
147186 AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
148187 run : |
149188 aws s3 sync \
150- dist/appstore-publish/v2/${{ steps.resolve_channel.outputs.channel }}/appstore/manifests \
151- s3://artifact/websoft9/v2/${{ steps.resolve_channel.outputs.channel }}/appstore/manifests \
152- --endpoint-url "$AWS_ENDPOINT_URL"
189+ dist/appstore-publish/appstore/${{ steps.resolve_channel.outputs.channel }}/manifests \
190+ s3://artifact/appstore/${{ steps.resolve_channel.outputs.channel }}/manifests \
191+ --endpoint-url "$AWS_ENDPOINT_URL"
192+
193+ # ── legacy uploads (old R2 paths, kept for backward compatibility) ──
194+
195+ - name : Upload legacy library to Cloudflare R2
196+ env :
197+ AWS_ACCESS_KEY_ID : ${{ secrets.CLOUDFLARE_R2_SECRET_ID }}
198+ AWS_SECRET_ACCESS_KEY : ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
199+ AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
200+ run : |
201+ aws s3 sync \
202+ dist/appstore-publish/legacy/${{ steps.resolve_channel.outputs.channel }}/library \
203+ s3://artifact/${{ steps.resolve_channel.outputs.channel }}/websoft9/plugin/library \
204+ --endpoint-url "$AWS_ENDPOINT_URL"
205+
206+ - name : Upload legacy media to Cloudflare R2
207+ env :
208+ AWS_ACCESS_KEY_ID : ${{ secrets.CLOUDFLARE_R2_SECRET_ID }}
209+ AWS_SECRET_ACCESS_KEY : ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
210+ AWS_ENDPOINT_URL : https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
211+ run : |
212+ aws s3 sync \
213+ dist/appstore-publish/legacy/${{ steps.resolve_channel.outputs.channel }}/media \
214+ s3://artifact/${{ steps.resolve_channel.outputs.channel }}/websoft9/plugin/media \
215+ --endpoint-url "$AWS_ENDPOINT_URL"
216+
217+ - name : Resolve legacy purge URLs
218+ id : purge_urls
219+ run : |
220+ if [[ "${{ steps.resolve_channel.outputs.channel }}" == "dev" ]]; then
221+ echo "urls=[\"https://artifact.websoft9.com/dev/websoft9/plugin/library/library-dev.zip\",\"https://artifact.websoft9.com/dev/websoft9/plugin/media/media-dev.zip\"]" >> "$GITHUB_OUTPUT"
222+ else
223+ echo "urls=[\"https://artifact.websoft9.com/release/websoft9/plugin/library/library-latest.zip\",\"https://artifact.websoft9.com/release/websoft9/plugin/media/media.zip\"]" >> "$GITHUB_OUTPUT"
224+ fi
225+
226+ - name : Purge legacy Cloudflare Cache
227+ uses : jakejarvis/cloudflare-purge-action@v2
228+ env :
229+ CLOUDFLARE_ZONE : ${{ secrets.CLOUDFLARE_ZONE_ID }}
230+ CLOUDFLARE_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
231+ with :
232+ PURGE_URLS : ${{ steps.purge_urls.outputs.urls }}
233+
234+ - name : Create GitHub Release (release channel only)
235+ if : steps.resolve_channel.outputs.channel == 'release'
236+ uses : softprops/action-gh-release@v1
237+ with :
238+ files : |
239+ dist/appstore-publish/legacy/release/library/library.json
240+ tag_name : release-${{ github.run_number }}
241+ name : Release ${{ github.run_number }}
242+ draft : false
243+ prerelease : false
244+
245+ pages :
246+ name : Build Github Pages (release only)
247+ if : github.ref_name == 'main'
248+ needs : publish
249+ permissions :
250+ contents : read
251+ pages : write
252+ id-token : write
253+ environment :
254+ name : github-pages
255+ url : ${{ steps.deployment.outputs.page_url }}
256+ runs-on : ubuntu-latest
257+ steps :
258+ - name : Checkout
259+ uses : actions/checkout@v4
260+
261+ - name : Setup Pages
262+ uses : actions/configure-pages@v4
263+
264+ - name : Upload artifact
265+ uses : actions/upload-pages-artifact@v3
266+ with :
267+ path : ' .'
268+
269+ - name : Deploy to GitHub Pages
270+ id : deployment
271+ uses : actions/deploy-pages@v4
0 commit comments