Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/deploy-pages.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow is a bit different, it seems, from how we've set up Pages deployment for other repos (e.g. snap-account-abstraction-keyring). The way that these repos work is that when a new release is published, the site is deployed under both a v${version} directory as well as a latest directory: https://github.com/MetaMask/snap-account-abstraction-keyring/blob/145dca2d936a7617332cccbbe28dfbaf52f341fd/.github/workflows/publish-release.yml#L104. Also, the site is deployed for release candidate PRs under an rc-${version} directory: https://github.com/MetaMask/snap-account-abstraction-keyring/blob/145dca2d936a7617332cccbbe28dfbaf52f341fd/.github/workflows/publish-rc-dapp.yml.

Effectively, the site is versioned just like the package. Do we want to do that for this repo as well?

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Deploy to GitHub Pages using the dist/ folder from the build
name: Deploy to GitHub Pages

on:
push:
branches: [master]

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install Yarn dependencies
run: yarn --immutable
- name: Run build script
run: yarn build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist

deploy:
name: Deploy
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
dist/
.pnp.*
.yarn/*
!.yarn/patches
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ To run the vault decryptor locally, ensure both Beefy and Browserify are install

`yarn build`

Then just include `bundle.js` in an HTML file.
This creates a `dist/` folder containing `index.html` and `bundle.js`.
23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"name": "@metamask/vault-decryptor",
"version": "1.0.0",
"private": true,
"version": "0.0.0",
"description": "Utility for decrypting MetaMask vault data",
"main": "index.js",
"files": [
"dist"
],
"scripts": {
"build": "mkdir -p dist && browserify index.js -o dist/bundle.js && cp index.html dist/",
"build:clean": "yarn clean && yarn build",
"clean": "rimraf dist",
"prepublishOnly": "yarn build",
"start": "beefy index.js:bundle.js --live --open",
"test": "jest && jest-it-up",
"build": "browserify index.js -o bundle.js"
"test": "jest && jest-it-up"
},
"browserify": {
"transform": [
Expand Down Expand Up @@ -56,7 +60,8 @@
"brfs": "^1.4.3",
"browserify": "^17.0.0",
"jest": "^29.4.1",
"jest-it-up": "^2.1.0"
"jest-it-up": "^2.1.0",
"rimraf": "^5.0.0"
},
"directories": {
"lib": "lib"
Expand All @@ -72,5 +77,9 @@
"engines": {
"node": ">=18.0.0"
},
"packageManager": "yarn@3.4.1"
"packageManager": "yarn@3.4.1",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Loading