Skip to content

Commit 15a4d50

Browse files
authored
Merge pull request #9675 from RaspberryPiFoundation/merger
chore: Merge `main` into `v13`
2 parents 5b79a29 + f454e1b commit 15a4d50

File tree

14 files changed

+428
-513
lines changed

14 files changed

+428
-513
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
name: Node.js CI
55

6-
on: [pull_request]
6+
on:
7+
pull_request:
8+
workflow_call:
79

810
permissions:
911
contents: read

.github/workflows/keyboard_plugin_test.yml

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

.github/workflows/publish.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
description: 'Dry run - print the version that would be published, but do not commit or publish anything.'
8+
required: false
9+
default: false
10+
type: boolean
11+
skip_versioning:
12+
description: >
13+
Skip version bump - use the version already in the repo
14+
(e.g. retry after npm publish failed but the release commit is already pushed).
15+
required: false
16+
default: false
17+
type: boolean
18+
19+
permissions:
20+
contents: write
21+
id-token: write
22+
23+
jobs:
24+
ci:
25+
uses: ./.github/workflows/build.yml
26+
27+
version:
28+
needs: ci
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 30
31+
outputs:
32+
version: ${{ steps.version.outputs.version }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v5
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v5
41+
with:
42+
node-version: 24.x
43+
registry-url: 'https://registry.npmjs.org'
44+
45+
- name: Install dependencies
46+
if: ${{ !inputs.skip_versioning }}
47+
run: npm ci
48+
49+
- name: Determine version bump
50+
id: bump
51+
if: ${{ !inputs.skip_versioning }}
52+
working-directory: packages/blockly
53+
run: |
54+
RELEASE_TYPE=$(npx conventional-recommended-bump --preset conventionalcommits -t blockly-)
55+
echo "release_type=$RELEASE_TYPE" >> "$GITHUB_OUTPUT"
56+
echo "Recommended bump: $RELEASE_TYPE"
57+
58+
- name: Apply version bump
59+
if: ${{ !inputs.skip_versioning }}
60+
working-directory: packages/blockly
61+
run: npm version ${{ steps.bump.outputs.release_type }} --no-git-tag-version
62+
63+
- name: Read package version
64+
id: version
65+
working-directory: packages/blockly
66+
run: |
67+
VERSION=$(node -p "require('./package.json').version")
68+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
69+
echo "Version: $VERSION"
70+
71+
- name: Upload versioned files
72+
if: ${{ !inputs.skip_versioning }}
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: versioned-files
76+
path: |
77+
packages/blockly/package.json
78+
package-lock.json
79+
80+
publish:
81+
needs: version
82+
runs-on: ubuntu-latest
83+
if: ${{ !inputs.dry_run }}
84+
environment: release
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v5
88+
with:
89+
fetch-depth: 0
90+
ssh-key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
91+
92+
- name: Download versioned files
93+
if: ${{ !inputs.skip_versioning }}
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: versioned-files
97+
98+
- name: Commit and push version bump
99+
if: ${{ !inputs.skip_versioning }}
100+
run: |
101+
git config user.name "github-actions[bot]"
102+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
103+
git add packages/blockly/package.json package-lock.json
104+
git commit -m "release: v${{ needs.version.outputs.version }}"
105+
git push
106+
107+
- name: Setup Node.js
108+
uses: actions/setup-node@v5
109+
with:
110+
node-version: 24.x
111+
registry-url: 'https://registry.npmjs.org'
112+
113+
- name: Install dependencies
114+
run: npm ci
115+
116+
- name: Build package
117+
working-directory: packages/blockly
118+
run: npm run package
119+
120+
- name: Publish to npm
121+
working-directory: packages/blockly/dist
122+
run: npm publish --verbose
123+
124+
- name: Create tarball
125+
working-directory: packages/blockly
126+
run: npm pack ./dist
127+
128+
- name: Create GitHub release
129+
working-directory: packages/blockly
130+
env:
131+
GH_TOKEN: ${{ github.token }}
132+
run: |
133+
TARBALL="blockly-${{ needs.version.outputs.version }}.tgz"
134+
gh release create "blockly-v${{ needs.version.outputs.version }}" "$TARBALL" \
135+
--repo "$GITHUB_REPOSITORY" \
136+
--title "blockly-v${{ needs.version.outputs.version }}" \
137+
--generate-notes
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Manual workflow to update GitHub Pages from a chosen source branch.
2+
# The gulp updateGithubPages task builds the repo and force-pushes to gh-pages.
3+
4+
name: Update GitHub Pages
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
source_branch:
10+
description: 'Source branch to build and deploy to GitHub Pages'
11+
required: true
12+
type: string
13+
default: main
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
update-gh-pages:
20+
timeout-minutes: 15
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v5
25+
with:
26+
ref: ${{ inputs.source_branch }}
27+
fetch-depth: 0
28+
29+
- name: Use Node.js
30+
uses: actions/setup-node@v5
31+
with:
32+
node-version: 24.x
33+
34+
- name: Update GitHub Pages
35+
working-directory: ./packages/blockly
36+
run: npm run updateGithubPages:staging

0 commit comments

Comments
 (0)