forked from MetaMask/metamask-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.56 KB
/
sync-and-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Sync Fork and Build Without LavaMoat
on:
# Trigger on new releases in the original repo
repository_dispatch:
types: [upstream-release]
# Allow manual trigger
workflow_dispatch:
# Check for updates every day
schedule:
- cron: '0 0 * * *'
jobs:
sync-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Add upstream remote
run: |
git remote add upstream https://github.com/MetaMask/metamask-extension.git
git fetch upstream
- name: Sync with upstream
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git checkout develop
git merge upstream/develop
git push origin develop
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable Corepack
run: corepack enable
- name: Setup environment
env:
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
run: |
# Copy the dist file
cp .metamaskrc.dist .metamaskrc
# Use different sed syntax for Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/INFURA_PROJECT_ID=.*/INFURA_PROJECT_ID=$INFURA_PROJECT_ID/g" .metamaskrc
else
sed -i "s/INFURA_PROJECT_ID=.*/INFURA_PROJECT_ID=$INFURA_PROJECT_ID/g" .metamaskrc
fi
- name: Install dependencies
run: yarn install
- name: Build without LavaMoat
run: yarn dist --apply-lavamoat=false
- name: Create Release
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
VERSION=$(node -p "require('./package.json').version")
# Check if release already exists
if gh release view "v${VERSION}-no-lavamoat" --repo ${{ github.repository }} &>/dev/null; then
echo "Release v${VERSION}-no-lavamoat already exists. Skipping release creation."
exit 0
fi
# Create the release if it doesn't exist
gh release create "v${VERSION}-no-lavamoat" \
--repo ${{ github.repository }} \
--title "v${VERSION} (No LavaMoat)" \
--notes "MetaMask v${VERSION} built without LavaMoat" \
./builds/metamask-chrome-*.zip \
./builds/metamask-firefox-*.zip