Skip to content

Commit

Permalink
add new workflows
Browse files Browse the repository at this point in the history
Signed-off-by: drptbl <[email protected]>
  • Loading branch information
drptbl committed Nov 15, 2024
1 parent 95f8b95 commit b44d9a3
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/monitor-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Monitor Upstream Releases

on:
schedule:
- cron: '*/30 * * * *' # Check every 30 minutes

jobs:
check-releases:
runs-on: ubuntu-latest
steps:
- name: Check for new releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/MetaMask/metamask-extension/releases/latest" | jq -r .tag_name)
echo "Latest upstream release: $LATEST_RELEASE"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"event_type\": \"upstream-release\", \"client_payload\": {\"release\": \"$LATEST_RELEASE\"}}" \
"https://api.github.com/repos/${{ github.repository }}/dispatches"
74 changes: 74 additions & 0 deletions .github/workflows/sync-and-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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

- 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
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -p "require('./package.json').version")
gh release create "v${VERSION}-no-lavamoat" \
--title "v${VERSION} (No LavaMoat)" \
--notes "MetaMask v${VERSION} built without LavaMoat" \
./builds/metamask-chrome-*.zip \
./builds/metamask-firefox-*.zip

0 comments on commit b44d9a3

Please sign in to comment.