Skip to content

Commit c7945f8

Browse files
Update workflows, publish beta site
1 parent 2eb4ff3 commit c7945f8

5 files changed

Lines changed: 117 additions & 126 deletions

File tree

.github/workflows/compress-images-on-pull-request.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Publish beta site
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout pxt-ev3
24+
uses: actions/checkout@v4
25+
with:
26+
repository: pxt-ev3-community/pxt-ev3
27+
fetch-depth: 0
28+
29+
- name: Update version in package.json
30+
run: |
31+
CLEAN_VERSION=$(git describe | sed 's/^v//')
32+
sed -i "s/\"version\": \".*\"/\"version\": \"$CLEAN_VERSION\"/" package.json
33+
34+
- name: Checkout deploy tools
35+
uses: actions/checkout@v4
36+
with:
37+
repository: pxt-ev3-community/pxt-ev3-community.github.io
38+
path: github-deploy
39+
40+
- name: Checkout translations
41+
uses: actions/checkout@v4
42+
with:
43+
repository: pxt-ev3-community/pxt-ev3-translations
44+
path: translations
45+
46+
- name: Setup Node.js
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: 20
50+
51+
- name: Install PXT globally
52+
run: npm install -g pxt
53+
54+
- name: Install project dependencies
55+
run: npm install --ignore-scripts
56+
57+
- name: Pin legacy deps
58+
run: npm install @types/ws@8.5.4 --no-save
59+
60+
- name: Apply pxtarget.json overrides
61+
run: |
62+
mv pxtarget.json pxtarget-original.json
63+
jq -s '.[0] * .[1]' pxtarget-original.json github-deploy/pxtarget-override.json > pxtarget.json
64+
65+
- name: Build static package
66+
run: pxt staticpkg --locs-src translations --route pxt-ev3/beta
67+
68+
- name: Copy docs static assets into package
69+
run: |
70+
mkdir -p built/packaged/docs/static
71+
if [ -d docs/static ]; then
72+
cp -R docs/static/. built/packaged/pxt-ev3/beta/docs/static/
73+
cd built/packaged/pxt-ev3/beta
74+
ln -s docs/static static
75+
fi
76+
77+
- name: Patch html json and manifest only
78+
run: |
79+
set -e
80+
PKG="built/packaged"
81+
find "$PKG" -type f \( -name '*.html' -o -name '*.json' -o -name '*.webmanifest' \) -print0 | while IFS= read -r -d '' f; do
82+
sed -i 's#@cdnUrl@#/pxt-ev3/beta/#g' "$f" || true
83+
done
84+
85+
- name: Debug packaged output
86+
run: |
87+
echo "=== remaining @cdnUrl@ in html/json/webmanifest ==="
88+
find built/packaged -type f \( -name '*.html' -o -name '*.json' -o -name '*.webmanifest' \) -exec grep -nH '@cdnUrl@' {} \; || true
89+
echo "=== docs/static files copied ==="
90+
find built/packaged/docs/static -type f | sort | head -n 200 || true
91+
echo "=== index.html references to docs/static ==="
92+
grep -n 'docs/static' built/packaged/index.html || true
93+
94+
- name: Verify package output exists
95+
run: |
96+
test -d built/packaged
97+
test -f built/packaged/pxt-ev3/beta/index.html
98+
99+
- name: Upload Pages artifact
100+
uses: actions/upload-pages-artifact@v3
101+
with:
102+
path: built/packaged/pxt-ev3
103+
104+
deploy:
105+
needs: build
106+
runs-on: ubuntu-latest
107+
permissions:
108+
pages: write
109+
id-token: write
110+
environment:
111+
name: github-pages
112+
url: ${{ steps.deployment.outputs.page_url }}
113+
114+
steps:
115+
- name: Deploy to GitHub Pages
116+
id: deployment
117+
uses: actions/deploy-pages@v4

.github/workflows/pxt-buildmain.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/pxt-buildpr.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/pxt-buildpush.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)