Skip to content

Commit e89270a

Browse files
committed
Merge upstream/develop and resolve conflicts
2 parents d93779a + 464d62e commit e89270a

File tree

365 files changed

+17568
-33063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+17568
-33063
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
fi
2626
# When the main workflow calls many workspace workflows, we can reuse this cache for all of them.
2727
# Since this is caching the node_modules directory, DO NOT add partial-match restore keys!
28-
- uses: actions/cache/restore@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
28+
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2929
id: restore-node-modules-cache
3030
with:
3131
path: |
@@ -39,7 +39,7 @@ runs:
3939
working-directory: .
4040
shell: bash
4141
run: NODE_ENV=development npm ci
42-
- uses: actions/cache/save@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
42+
- uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
4343
if: steps.restore-node-modules-cache.outputs.cache-hit != 'true'
4444
with:
4545
path: |

.github/actions/test-package/action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ runs:
1919
- name: Test
2020
working-directory: ./packages/${{ inputs.package_name }}
2121
shell: bash
22+
env:
23+
TAP_REPORTER: "junit"
24+
TAP_REPORTER_FILE: "test-results/junit.xml"
2225
run: |
2326
mkdir -p test-results
24-
npm run test | tee -a ./test-results/${{ inputs.package_name }}-test-results.txt
27+
npm run test
28+
- name: Publish test reports
29+
if: ${{ !cancelled() }}
30+
uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2
31+
with:
32+
files: "./packages/${{ inputs.package_name }}/test-results/**/*"
33+
check_name: "Test report for ${{ inputs.package_name }}"
34+
test_file_prefix: "+packages/${{ inputs.package_name }}/"
2535
- name: Store Test Results
2636
if: ${{ !cancelled() }}
27-
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
37+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
2838
with:
2939
name: ${{ inputs.package_name }}-test-output
3040
path: ./packages/${{ inputs.package_name }}/test-results/*

.github/workflows/ci.yml

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,22 @@ jobs:
1919
any-workspace: ${{ steps.filter.outputs.any-workspace }}
2020
packages: ${{ steps.filter.outputs.changes }}
2121
steps:
22-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
23-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
22+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
2424
with:
2525
cache: 'npm'
2626
node-version-file: '.nvmrc'
2727
- name: Debug info
2828
# https://docs.github.com/en/actions/reference/security/secure-use#use-an-intermediate-environment-variable
2929
env:
30-
GH_HEAD_REF: ${{ github.head_ref }}
30+
# `env:` values are printed to the log even without using them in `run:`
31+
GH_CONTEXT: ${{ toJson(github) }}
3132
run: |
3233
cat <<EOF
33-
Scratch environment: ${{ vars.SCRATCH_ENV || '<none>' }}
34+
Working directory: $(pwd)
3435
Node version: $(node --version)
3536
NPM version: $(npm --version)
36-
GitHub ref: ${{ github.ref }}
37-
GitHub head ref: ${GH_HEAD_REF}
38-
Working directory: $(pwd)
37+
Scratch environment: ${{ vars.SCRATCH_ENV || '<none>' }}
3938
EOF
4039
4140
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
@@ -52,7 +51,7 @@ jobs:
5251

5352
- name: Store build artifacts
5453
if: ${{ steps.filter.outputs.any-workspace == 'true' }}
55-
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
54+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
5655
with:
5756
name: build
5857
path: |
@@ -73,25 +72,79 @@ jobs:
7372
- package: any-workspace
7473
name: Test ${{ matrix.package }}
7574
steps:
76-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
77-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
75+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
76+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
7877
with:
7978
cache: 'npm'
8079
node-version-file: '.nvmrc'
8180
- uses: ./.github/actions/install-dependencies
82-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
81+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
8382
with:
8483
name: build
8584
path: packages
8685
- uses: ./.github/actions/test-package
8786
with:
8887
package_name: ${{ matrix.package }}
8988

89+
preview:
90+
runs-on: ubuntu-latest
91+
needs: build
92+
# We don't want to give forks free reign to publish to our GitHub Pages, so run this job only if both:
93+
# - any workspace changed (otherwise there's no work to do)
94+
# - and either
95+
# - this is not a PR (so it's some other event that happened in our fork, like a push or merge group)
96+
# - or it's a PR from our fork (not some other fork)
97+
# - and
98+
# - it's not a Renovate branch (just to reduce noise)
99+
if: ${{
100+
(needs.build.outputs.any-workspace == 'true') &&
101+
(
102+
(!github.event.pull_request) ||
103+
(github.event.pull_request.head.repo.full_name == github.repository)
104+
) &&
105+
(!startsWith((github.head_ref || github.ref_name), 'renovate/'))
106+
}}
107+
name: Publish preview playgrounds to GitHub Pages
108+
steps:
109+
- name: Determine GitHub Pages directory name
110+
id: branch_dir_name
111+
# even `develop` should be published to a subdirectory
112+
# that way each branch can be updated or cleaned up independently
113+
run: |
114+
echo "result=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" | tee --append "$GITHUB_OUTPUT"
115+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
116+
with:
117+
name: build
118+
path: packages
119+
- name: Prepare playgrounds for GitHub Pages
120+
working-directory: ./packages
121+
run: |
122+
mkdir -p ../pages/
123+
for pkg in *; do
124+
if [ -d "${pkg}/playground" ]; then
125+
# using symlinks is quick and artifact generation will dereference them
126+
# if the GitHub Pages action stops dereferencing these links, we'll need to copy the files instead
127+
ln -s "../packages/${pkg}/playground" "../pages/${pkg}"
128+
fi
129+
done
130+
131+
# scratch-gui doesn't follow the pattern above
132+
ln -s "../packages/scratch-gui/build" "../pages/scratch-gui"
133+
134+
ls -l ../pages/
135+
- name: Deploy playgrounds to GitHub Pages
136+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
137+
with:
138+
github_token: ${{ secrets.GITHUB_TOKEN }}
139+
publish_dir: ./pages
140+
destination_dir: "${{steps.branch_dir_name.outputs.result}}"
141+
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
142+
90143
results:
91-
name: Results
144+
name: Test Results
92145
runs-on: ubuntu-latest
93146
needs: test
94-
if: ${{ always() }}
147+
if: ${{ !cancelled() }}
95148
steps:
96149
- run: |
97150
case "${{ needs.test.result }}" in

.github/workflows/commitlint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ jobs:
88
commitlint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
12-
- uses: wagoid/commitlint-github-action@9763196e10f27aef304c9b8b660d31d97fce0f99 # v5
11+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
12+
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: GitHub Pages Cleanup
2+
3+
on:
4+
schedule:
5+
- cron: 0 0 * * 6 # midnight on Saturdays
6+
workflow_dispatch:
7+
8+
jobs:
9+
cleanup:
10+
permissions:
11+
contents: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out GitHub Pages branch
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
16+
with:
17+
# replace `fetch-depth` with `shallow-since` if and when actions/checkout#619 (or an equivalent) gets merged
18+
# then remove the "Fetch a bit more history" step below
19+
fetch-depth: 1
20+
ref: gh-pages
21+
- name: Fetch a bit more history
22+
run: git fetch --update-shallow --shallow-since="32 days ago" origin gh-pages
23+
- name: Mark stale directories for removal
24+
run: |
25+
for dir in */; do
26+
[ -L "${dir%/}" ] && continue # skip symlinks (trim trailing slash for test)
27+
if [ -z "$(git log -n 1 --since "1 month ago" -- "$dir")" ]; then
28+
echo "Removing stale directory: $dir"
29+
git rm --quiet -r "$dir"
30+
fi
31+
done
32+
- name: Configure git user
33+
run: |
34+
git config user.name 'github-actions[bot]'
35+
git config user.email 'github-actions[bot]@users.noreply.github.com'
36+
- name: Commit
37+
run: |
38+
if git diff --staged --quiet; then
39+
echo 'No stale directories were found. Nothing to commit.'
40+
else
41+
git commit -m 'chore: remove stale GitHub Pages branches'
42+
fi
43+
- name: Push
44+
run: "git push"

.github/workflows/publish.yml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ jobs:
5151
git config --global user.name 'GitHub Actions'
5252
git config --global user.email 'github-actions@localhost'
5353
54-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
54+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
5555
with:
5656
token: ${{ secrets.PAT_RELEASE_PUSH }} # persists the token for pushing to the repo later
5757

58-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
58+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
5959
with:
6060
cache: 'npm'
6161
node-version-file: '.nvmrc'
@@ -112,12 +112,7 @@ jobs:
112112

113113
- name: Publish scratch-gui-standalone
114114
run: |
115-
jq '
116-
.name = "@scratch/scratch-gui-standalone" |
117-
del(.peerDependencies) |
118-
.exports."." = .exports."./standalone" |
119-
del(.exports."./standalone")
120-
' ./packages/scratch-gui/package.json | npx sponge ./packages/scratch-gui/package.json
115+
bash ./scripts/prepare-standalone-gui.sh
121116
122117
npm --workspace=@scratch/scratch-gui-standalone run clean && npm --workspace=@scratch/scratch-gui-standalone run build:dist-standalone
123118
npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" --workspace=@scratch/scratch-gui-standalone
@@ -145,35 +140,3 @@ jobs:
145140
run: |
146141
git tag -f "${{github.event.release.tag_name}}" HEAD
147142
git push -f origin "refs/tags/${{github.event.release.tag_name}}"
148-
149-
- name: Deploy scratch-svg-renderer to GitHub Pages
150-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
151-
with:
152-
github_token: ${{ secrets.GITHUB_TOKEN }}
153-
publish_dir: ./packages/scratch-svg-renderer/playground
154-
destination_dir: scratch-svg-renderer
155-
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
156-
157-
- name: Deploy scratch-render to GitHub Pages
158-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
159-
with:
160-
github_token: ${{ secrets.GITHUB_TOKEN }}
161-
publish_dir: ./packages/scratch-render/playground
162-
destination_dir: scratch-render
163-
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
164-
165-
- name: Deploy scratch-vm to GitHub Pages
166-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
167-
with:
168-
github_token: ${{ secrets.GITHUB_TOKEN }}
169-
publish_dir: ./packages/scratch-vm/playground
170-
destination_dir: scratch-vm
171-
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
172-
173-
- name: Deploy scratch-gui to GitHub Pages
174-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
175-
with:
176-
github_token: ${{ secrets.GITHUB_TOKEN }}
177-
publish_dir: ./packages/scratch-gui/build
178-
destination_dir: scratch-gui
179-
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"

.github/workflows/update-i18n.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
update-i18n:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
20+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
2121
with:
2222
cache: 'npm'
2323
node-version-file: '.nvmrc'

0 commit comments

Comments
 (0)