Skip to content

Commit b663c4f

Browse files
authored
Merge branch 'main' into quenting/dynamic-policy-data
2 parents c8a33f0 + fdfcfe0 commit b663c4f

File tree

7 files changed

+646
-1053
lines changed

7 files changed

+646
-1053
lines changed

.github/scripts/cleanup-pr.cjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2025 New Vector Ltd.
2+
//
3+
// SPDX-License-Identifier: AGPL-3.0-only
4+
// Please see LICENSE in the repository root for full details.
5+
6+
// @ts-check
7+
8+
/** @param {import('@actions/github-script').AsyncFunctionArguments} AsyncFunctionArguments */
9+
module.exports = async ({ github, context }) => {
10+
const metadataJson = process.env.BUILD_IMAGE_MANIFEST;
11+
if (!metadataJson) throw new Error("BUILD_IMAGE_MANIFEST is not defined");
12+
/** @type {Record<string, {tags: string[]}>} */
13+
const metadata = JSON.parse(metadataJson);
14+
15+
await github.rest.issues.removeLabel({
16+
issue_number: context.issue.number,
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
name: "Z-Build-Workflow",
20+
});
21+
22+
const tagListMarkdown = metadata.regular.tags
23+
.map((tag) => `- \`${tag}\``)
24+
.join("\n");
25+
26+
// Get the workflow run
27+
const run = await github.rest.actions.getWorkflowRun({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
run_id: context.runId,
31+
});
32+
33+
await github.rest.issues.createComment({
34+
issue_number: context.issue.number,
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
body: `A build for this PR at commit <kbd>${context.sha}</kbd> has been created through the <kbd>Z-Build-Workflow</kbd> label by <kbd>${context.actor}</kbd>.
38+
39+
Docker image is available at:
40+
${tagListMarkdown}
41+
42+
Pre-built binaries are available through the [workflow run artifacts](${run.data.html_url}).`,
43+
});
44+
};

.github/workflows/build.yaml

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ on:
44
push:
55
branches:
66
- main
7-
- 'release/**'
7+
- "release/**"
88
tags:
99
- "v*"
1010

11-
# Only run for pull requests if relevant files were changed
11+
# Run when there is a label change on the pull request
12+
# This runs only if the 'Z-Build-Workflow' is added to the pull request
1213
pull_request:
13-
branches:
14-
- main
15-
- 'release/**'
14+
types: [labeled]
1615

1716
concurrency:
1817
group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,10 +30,16 @@ env:
3130
jobs:
3231
compute-version:
3332
name: Compute version using git describe
33+
if: github.event_name == 'push' || github.event.label.name == 'Z-Build-Workflow'
3434
runs-on: ubuntu-24.04
35+
36+
permissions:
37+
contents: read
38+
3539
outputs:
3640
describe: ${{ steps.git.outputs.describe }}
3741
timestamp: ${{ steps.git.outputs.timestamp }}
42+
3843
steps:
3944
- name: Checkout the code
4045
uses: actions/[email protected]
@@ -50,6 +55,7 @@ jobs:
5055
5156
build-assets:
5257
name: Build assets
58+
if: github.event_name == 'push' || github.event.label.name == 'Z-Build-Workflow'
5359
runs-on: ubuntu-24.04
5460

5561
permissions:
@@ -81,6 +87,7 @@ jobs:
8187

8288
build-binaries:
8389
name: Build binaries
90+
if: github.event_name == 'push' || github.event.label.name == 'Z-Build-Workflow'
8491
runs-on: ubuntu-24.04
8592

8693
needs:
@@ -139,6 +146,7 @@ jobs:
139146

140147
assemble-archives:
141148
name: Assemble release archives
149+
if: github.event_name == 'push' || github.event.label.name == 'Z-Build-Workflow'
142150
runs-on: ubuntu-24.04
143151

144152
needs:
@@ -193,6 +201,7 @@ jobs:
193201

194202
build-image:
195203
name: Build and push Docker image
204+
if: github.event_name == 'push' || github.event.label.name == 'Z-Build-Workflow'
196205
runs-on: ubuntu-24.04
197206

198207
outputs:
@@ -221,6 +230,7 @@ jobs:
221230
latest=auto
222231
tags: |
223232
type=ref,event=branch
233+
type=ref,event=pr
224234
type=semver,pattern={{version}}
225235
type=semver,pattern={{major}}.{{minor}}
226236
type=semver,pattern={{major}}
@@ -237,6 +247,7 @@ jobs:
237247
suffix=-debug,onlatest=true
238248
tags: |
239249
type=ref,event=branch
250+
type=ref,event=pr
240251
type=semver,pattern={{version}}
241252
type=semver,pattern={{major}}.{{minor}}
242253
type=semver,pattern={{major}}
@@ -252,6 +263,7 @@ jobs:
252263
latest=auto
253264
tags: |
254265
type=ref,event=branch
266+
type=ref,event=pr
255267
type=semver,pattern={{version}}
256268
type=semver,pattern={{major}}.{{minor}}
257269
type=semver,pattern={{major}}
@@ -268,31 +280,15 @@ jobs:
268280
mirrors = ["mirror.gcr.io"]
269281
270282
- name: Login to GitHub Container Registry
271-
if: github.event_name != 'pull_request'
272283
uses: docker/[email protected]
273284
with:
274285
registry: ghcr.io
275286
username: ${{ github.repository_owner }}
276287
password: ${{ secrets.GITHUB_TOKEN }}
277288

278-
# For pull-requests, only read from the cache, do not try to push to the
279-
# cache or the image itself
280-
- name: Build
281-
uses: docker/[email protected]
282-
if: github.event_name == 'pull_request'
283-
with:
284-
files: |
285-
./docker-bake.hcl
286-
cwd://${{ steps.meta.outputs.bake-file }}
287-
cwd://${{ steps.meta-debug.outputs.bake-file }}
288-
cwd://${{ steps.meta-syn2mas.outputs.bake-file }}
289-
set: |
290-
base.cache-from=type=registry,ref=${{ env.BUILDCACHE }}:buildcache
291-
292289
- name: Build and push
293290
id: bake
294291
uses: docker/[email protected]
295-
if: github.event_name != 'pull_request'
296292
with:
297293
files: |
298294
./docker-bake.hcl
@@ -308,7 +304,6 @@ jobs:
308304
# This transforms the ouput to an object which looks like this:
309305
# { reguar: { digest: "…", tags: ["…", "…"] }, debug: { digest: "…", tags: ["…"] }, … }
310306
id: output
311-
if: github.event_name != 'pull_request'
312307
run: |
313308
echo 'metadata<<EOF' >> $GITHUB_OUTPUT
314309
echo '${{ steps.bake.outputs.metadata }}' | jq -c 'with_entries(select(.value | (type == "object" and has("containerimage.digest")))) | map_values({ digest: .["containerimage.digest"], tags: (.["image.name"] | split(",")) })' >> $GITHUB_OUTPUT
@@ -334,13 +329,12 @@ jobs:
334329
syn2mas:
335330
name: Release syn2mas on NPM
336331
runs-on: ubuntu-24.04
332+
if: github.event_name != 'pull_request'
337333

338334
permissions:
339335
contents: read
340336
id-token: write
341337

342-
if: github.event_name != 'pull_request'
343-
344338
steps:
345339
- name: Checkout the code
346340
uses: actions/[email protected]
@@ -428,14 +422,16 @@ jobs:
428422

429423
unstable:
430424
name: Update the unstable release
425+
if: github.ref == 'refs/heads/main'
431426
runs-on: ubuntu-24.04
427+
432428
needs:
433429
- assemble-archives
434430
- build-image
435-
if: github.ref == 'refs/heads/main'
436431

437432
permissions:
438433
contents: write
434+
439435
steps:
440436
- name: Checkout the code
441437
uses: actions/[email protected]
@@ -460,7 +456,7 @@ jobs:
460456
- name: Update unstable release
461457
uses: softprops/action-gh-release@v2
462458
with:
463-
name: 'Unstable build'
459+
name: "Unstable build"
464460
tag_name: unstable
465461
body: |
466462
This is an automatically updated unstable release containing the latest builds from the main branch.
@@ -501,3 +497,31 @@ jobs:
501497
artifacts/mas-cli-x86_64-linux.tar.gz
502498
prerelease: true
503499
make_latest: false
500+
501+
pr-cleanup:
502+
name: "Remove workflow build PR label and comment on it"
503+
runs-on: ubuntu-24.04
504+
if: github.event_name == 'pull_request' && github.event.label.name == 'Z-Build-Workflow'
505+
506+
needs:
507+
- build-image
508+
509+
permissions:
510+
contents: read
511+
pull-requests: write
512+
513+
steps:
514+
- name: Checkout the code
515+
uses: actions/[email protected]
516+
with:
517+
sparse-checkout: |
518+
.github/scripts
519+
520+
- name: Remove label and comment
521+
uses: actions/[email protected]
522+
env:
523+
BUILD_IMAGE_MANIFEST: ${{ needs.build-image.outputs.metadata }}
524+
with:
525+
script: |
526+
const script = require('./.github/scripts/cleanup-pr.cjs');
527+
await script({ core, github, context });

frontend/.storybook/public/mockServiceWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* - Please do NOT serve this file on production.
99
*/
1010

11-
const PACKAGE_VERSION = '2.7.1'
11+
const PACKAGE_VERSION = '2.7.3'
1212
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
1313
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
1414
const activeClientIds = new Set()

0 commit comments

Comments
 (0)