diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..fbdb05f --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -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 diff --git a/.gitignore b/.gitignore index 4c1fb8c..11219e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ +dist/ .pnp.* .yarn/* !.yarn/patches diff --git a/README.md b/README.md index 7176721..ab13367 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/package.json b/package.json index 30dd082..f825482 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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" @@ -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/" + } }