Skip to content
Merged
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
56 changes: 56 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'enhancement'
patch:
labels:
- 'patch'
- 'bug'
default: patch
template: |
## Changes

$CHANGES
autolabeler:
- label: 'chore'
files:
- '*.md'
branch:
- '/docs{0,1}\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- '/bugfix/i'
- label: 'enhancement'
title:
- '/added/i'
- '/add/i'
- '/feature/i'
- '/feat/i'
- '/support/i'
- '/enable/i'
branch:
- '/feature\/.+/'
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release
on:
release:
types: [ published ]
env:
GIT_TERMINAL_PROMPT: 1

jobs:
upload-extension:
name: Build and upload extension to Chrome Web Store
runs-on: ubuntu-latest
env:
EXTENSION_ID: lamobknkahhlgennggjjphcdfndjkafj

steps:
- name: Build and upload extension to Chrome Web Store
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18.12.1'
- run: |
npm install
initialTag=${{ github.event.release.tag_name }}
tag="${initialTag//[v]/}"
echo $tag
git remote update
git fetch
git checkout --track origin/main
git config --global user.email "github-actions@github.com"
git config --global user.name "Github Actions"
npm --no-git-tag-version --allow-same-version version $tag
npm run update-manifest-version
npm i -g auto-changelog
auto-changelog --hide-credit -l 100
git add .
git commit -m "Release $tag"
npm run build
npm install -g chrome-webstore-upload-cli
chrome-webstore-upload upload \\
--source dist \\
--extension-id ${{ env.EXTENSION_ID }} \\
--client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \\
--client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \\
--refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
git push
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18.12.1'

- name: Build
run: |-
npm install
npm run build
zip -r extension-${{ github.sha }}.zip dist

- name: Archive extension artifact
uses: actions/upload-artifact@v2
with:
name: extension-${{ github.sha }}
path: extension-${{ github.sha }}.zip

- name: Test
run: npm run test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"build": "webpack --config webpack/webpack.config.cjs",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"update-manifest-version": "node scripts/update-manifest-version.js",
"lint": "eslint . --ext .ts,.tsx --max-warnings 0 --cache --cache-strategy content && echo 'Lint OK!'",
"lint:fix": "eslint . --ext .ts,.tsx --max-warnings 0 --cache --cache-strategy content --fix",
"prettier": "prettier --config .prettierrc.json 'src/**/*.ts' 'test/**/*.ts' --check",
Expand Down
16 changes: 12 additions & 4 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@
},
"content_scripts": [
{
"js": ["content.js"],
"matches": ["https://etherscan.io/tokenholdings*", "https://etherscan.io/address*", "https://portfolio.metamask.io/"]
"js": [
"content.js"
],
"matches": [
"https://etherscan.io/tokenholdings*",
"https://etherscan.io/address*",
"https://portfolio.metamask.io/"
]
}
],
"permissions": ["storage"],
"permissions": [
"storage"
],
"background": {
"service_worker": "background.js"
}
}
}
15 changes: 15 additions & 0 deletions scripts/update-manifest-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fs from 'fs';

const loadJSON = (path) => JSON.parse(fs.readFileSync(new URL(path, import.meta.url)));

const pkg = loadJSON('../package.json');
const manifest = loadJSON('../public/manifest.json');

if (pkg.version !== manifest.version) {
console.log(`updating manifest.json version: ${manifest.version} -> ${pkg.version}`)
manifest.version = pkg.version;
fs.writeFileSync(new URL('../public/manifest.json', import.meta.url), JSON.stringify(manifest, null, 2));

} else {
console.log(`manifest.json version (${manifest.version}) is the same as package.json version (${manifest.version}) - no need to update`)
}