Skip to content

Commit adbf51b

Browse files
Merge branch 'main' into migrate-petnames-sig
2 parents 97d9cfc + 6c80487 commit adbf51b

File tree

110 files changed

+10307
-419
lines changed

Some content is hidden

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

110 files changed

+10307
-419
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"customizations": {
33
"vscode": {
44
"extensions": [
5+
"dbaeumer.vscode-eslint",
56
"eamodio.gitlens",
7+
"esbenp.prettier-vscode",
68
"github.codespaces",
79
"github.copilot",
810
"github.copilot-chat",
911
"ms-azuretools.vscode-docker",
10-
"rvest.vs-code-prettier-eslint",
1112
"streetsidesoftware.code-spell-checker",
1213
"DigitalBrainstem.javascript-ejs-support"
1314
],
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
import { IncomingWebhook } from '@slack/webhook';
2+
import type { AnyBlock } from '@slack/types';
3+
import { version } from '../../package.json';
4+
5+
async function main() {
6+
const env = {
7+
OWNER: process.env.OWNER || 'metamask',
8+
REPOSITORY: process.env.REPOSITORY || 'metamask-extension',
9+
RUN_ID: process.env.RUN_ID || '',
10+
BRANCH: process.env.BRANCH || 'main',
11+
HOST_URL: process.env.HOST_URL || '',
12+
SLACK_NIGHTLY_BUILDS_WEBHOOK_URL:
13+
process.env.SLACK_NIGHTLY_BUILDS_WEBHOOK_URL || '',
14+
};
15+
16+
if (!env.RUN_ID) throw new Error('RUN_ID not found');
17+
if (!env.HOST_URL) throw new Error('HOST_URL not found');
18+
if (!env.SLACK_NIGHTLY_BUILDS_WEBHOOK_URL)
19+
throw new Error('SLACK_NIGHTLY_BUILDS_WEBHOOK_URL not found');
20+
21+
console.log(
22+
`🚀 Posting nightly builds for the ${env.REPOSITORY} repository ${env.BRANCH} branch to Slack`,
23+
);
24+
25+
const buildMap = {
26+
builds: {
27+
chrome: `${env.HOST_URL}/build-dist-browserify/builds/metamask-chrome-${version}.zip`,
28+
firefox: `${env.HOST_URL}/build-dist-mv2-browserify/builds/metamask-firefox-${version}.zip`,
29+
},
30+
'builds (experimental)': {
31+
chrome: `${env.HOST_URL}/build-experimental-browserify/builds/metamask-experimental-chrome-${version}.zip`,
32+
firefox: `${env.HOST_URL}/build-experimental-mv2-browserify/builds/metamask-experimental-firefox-${version}.zip`,
33+
},
34+
};
35+
36+
const webhook = new IncomingWebhook(env.SLACK_NIGHTLY_BUILDS_WEBHOOK_URL);
37+
38+
const repositoryUrl = new URL('https://github.com');
39+
repositoryUrl.pathname = `/${env.OWNER}/${env.REPOSITORY}`;
40+
41+
const branchUrl = new URL(repositoryUrl);
42+
branchUrl.pathname += `/tree/${env.BRANCH}`;
43+
44+
const runUrl = new URL(repositoryUrl);
45+
runUrl.pathname += `/actions/runs/${env.RUN_ID}`;
46+
47+
const currentDate = new Date().toLocaleDateString('en-US', {
48+
year: 'numeric',
49+
month: 'long',
50+
day: 'numeric',
51+
hour: '2-digit',
52+
minute: '2-digit',
53+
timeZoneName: 'short',
54+
});
55+
56+
const blocks: AnyBlock[] = [
57+
{
58+
type: 'rich_text',
59+
elements: [
60+
{
61+
type: 'rich_text_section',
62+
elements: [
63+
{
64+
type: 'emoji',
65+
name: 'rocket',
66+
},
67+
{
68+
type: 'text',
69+
text: ' Nightly Build Available - ',
70+
},
71+
{
72+
type: 'link',
73+
url: repositoryUrl.toString(),
74+
text: env.REPOSITORY,
75+
},
76+
{
77+
type: 'text',
78+
text: ' ',
79+
},
80+
{
81+
type: 'link',
82+
url: branchUrl.toString(),
83+
text: env.BRANCH,
84+
},
85+
{
86+
type: 'text',
87+
text: ` (v${version})`,
88+
},
89+
],
90+
},
91+
],
92+
},
93+
{
94+
type: 'rich_text',
95+
elements: [
96+
{
97+
type: 'rich_text_section',
98+
elements: [
99+
{
100+
type: 'text',
101+
text: `Built on ${currentDate}`,
102+
style: {
103+
italic: true,
104+
},
105+
},
106+
],
107+
},
108+
],
109+
},
110+
{
111+
type: 'divider',
112+
},
113+
{
114+
type: 'rich_text',
115+
elements: [
116+
{
117+
type: 'rich_text_section',
118+
elements: [
119+
{
120+
type: 'emoji' as const,
121+
name: 'package',
122+
},
123+
{
124+
type: 'text' as const,
125+
text: ' Download Links:\n',
126+
style: {
127+
bold: true,
128+
},
129+
},
130+
{
131+
type: 'emoji' as const,
132+
name: 'chrome',
133+
},
134+
{
135+
type: 'text' as const,
136+
text: ' ',
137+
},
138+
{
139+
type: 'link' as const,
140+
url: buildMap.builds.chrome,
141+
text: 'Main Chrome Extension',
142+
},
143+
{
144+
type: 'text' as const,
145+
text: '\n',
146+
},
147+
{
148+
type: 'emoji' as const,
149+
name: 'firefox',
150+
},
151+
{
152+
type: 'text' as const,
153+
text: ' ',
154+
},
155+
{
156+
type: 'link' as const,
157+
url: buildMap.builds.firefox,
158+
text: 'Main Firefox Extension',
159+
},
160+
{
161+
type: 'text' as const,
162+
text: '\n',
163+
},
164+
{
165+
type: 'emoji' as const,
166+
name: 'test_tube',
167+
},
168+
{
169+
type: 'text' as const,
170+
text: ' ',
171+
},
172+
{
173+
type: 'link' as const,
174+
url: buildMap['builds (experimental)'].chrome,
175+
text: 'Experimental Chrome Extension',
176+
},
177+
{
178+
type: 'text' as const,
179+
text: '\n',
180+
},
181+
{
182+
type: 'emoji' as const,
183+
name: 'test_tube',
184+
},
185+
{
186+
type: 'text' as const,
187+
text: ' ',
188+
},
189+
{
190+
type: 'link' as const,
191+
url: buildMap['builds (experimental)'].firefox,
192+
text: 'Experimental Firefox Extension',
193+
},
194+
{
195+
type: 'text' as const,
196+
text: '\n',
197+
},
198+
],
199+
},
200+
],
201+
},
202+
{
203+
type: 'divider',
204+
},
205+
{
206+
type: 'rich_text',
207+
elements: [
208+
{
209+
type: 'rich_text_section',
210+
elements: [
211+
{
212+
type: 'emoji',
213+
name: 'information_source',
214+
},
215+
{
216+
type: 'text',
217+
text: ' Build Info: ',
218+
style: {
219+
bold: true,
220+
},
221+
},
222+
{
223+
type: 'link',
224+
url: runUrl.toString(),
225+
text: 'View Build Logs',
226+
},
227+
],
228+
},
229+
],
230+
},
231+
];
232+
233+
await webhook.send({ blocks });
234+
console.log(
235+
'✅ Successfully posted the nightly builds notification to Slack',
236+
);
237+
}
238+
239+
main();

.github/workflows/nightly-build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Nightly Build
2+
3+
on:
4+
schedule:
5+
# Run daily at 02:00 UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
id-token: write # required for s3 uploads
12+
13+
jobs:
14+
build-dist-browserify:
15+
uses: ./.github/workflows/run-build.yml
16+
with:
17+
build-name: build-dist-browserify
18+
build-command: yarn build dist
19+
secrets: inherit
20+
21+
build-dist-mv2-browserify:
22+
uses: ./.github/workflows/run-build.yml
23+
with:
24+
build-name: build-dist-mv2-browserify
25+
build-command: yarn build dist
26+
mozilla-lint: true
27+
enable-mv3: false
28+
secrets: inherit
29+
30+
build-experimental-browserify:
31+
uses: ./.github/workflows/run-build.yml
32+
with:
33+
build-name: build-experimental-browserify
34+
build-command: yarn build --build-type experimental dist
35+
secrets: inherit
36+
37+
build-experimental-mv2-browserify:
38+
uses: ./.github/workflows/run-build.yml
39+
with:
40+
build-name: build-experimental-mv2-browserify
41+
build-command: yarn build --build-type experimental dist
42+
mozilla-lint: true
43+
enable-mv3: false
44+
secrets: inherit
45+
46+
post-nightly-builds:
47+
needs:
48+
- build-dist-browserify
49+
- build-dist-mv2-browserify
50+
- build-experimental-browserify
51+
- build-experimental-mv2-browserify
52+
runs-on: ubuntu-latest
53+
env:
54+
OWNER: ${{ github.repository_owner }}
55+
REPOSITORY: ${{ github.event.repository.name }}
56+
RUN_ID: ${{ github.run_id }}
57+
# For scheduled runs, use the default branch
58+
BRANCH: ${{ github.ref_name || 'main' }}
59+
HOST_URL: ${{ vars.AWS_CLOUDFRONT_URL }}/${{ github.event.repository.name }}/${{ github.run_id }}
60+
SLACK_NIGHTLY_BUILDS_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_BUILDS_WEBHOOK_URL }}
61+
steps:
62+
- name: Checkout and setup environment
63+
uses: MetaMask/action-checkout-and-setup@v1
64+
with:
65+
is-high-risk-environment: false
66+
skip-allow-scripts: true
67+
yarn-custom-url: ${{ vars.YARN_URL }}
68+
69+
- name: Post nightly builds
70+
run: yarn tsx .github/scripts/post-nightly-builds.ts

.vscode/cspell.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{
22
"ignorePaths": ["app/images", "package.json"],
33
"ignoreWords": [
4-
"acitores",
5-
"autofetch",
6-
"azuretools",
7-
"Brainstem",
84
"BUNDLESIZE",
5+
"Brainstem",
96
"C01LUJL3T98",
107
"C05QXJA7NP8",
8+
"acitores",
9+
"autofetch",
10+
"azuretools",
1111
"cids",
12+
"dbaeumer",
1213
"eamodio",
14+
"esbenp",
1315
"initialisation",
1416
"koalaman",
1517
"mockttp",
@@ -21,7 +23,6 @@
2123
"regadas",
2224
"remotedev",
2325
"ritave",
24-
"rvest",
2526
"sesify",
2627
"siginsights",
2728
"superstruct",

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
3-
"rvest.vs-code-prettier-eslint",
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
45
"streetsidesoftware.code-spell-checker",
56
"DigitalBrainstem.javascript-ejs-support"
67
]

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
33
"editor.tabSize": 2,
44
"files.associations": {
55
"app/*.html": "ejs"

0 commit comments

Comments
 (0)