Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Add extension artifacts on releases #240

Merged
merged 3 commits into from
Jun 22, 2022
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
47 changes: 47 additions & 0 deletions .github/actions/build-upload-extension/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build & Upload Extension
description: Builds & uploads extension for a broswer to a Github release

inputs:
node-version:
description: 'NodeJS version to use for setup & build'
required: true
browser:
description: 'Which browser to build the extension for'
required: true
file-name:
description: 'The name of the browser asset to upload'
required: true
tag-name:
description: 'Tag name of the release. Commonly github.ref in an on.release workflow'
required: true

runs:
using: composite
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: yarn
cache-dependency-path: extension/yarn.lock

- working-directory: ./extension
shell: bash
run: |
cp .env.release .env
yarn install --frozen-lockfile
- working-directory: ./extension
shell: bash
run: |
CRYPTO_COMPARE_API_KEY=${CRYPTO_COMPARE_API_KEY} \
NETWORK_CONFIG_PATH=../contracts/networks/arbitrum-testnet.json \
yarn build:${{ inputs.browser }}
- working-directory: ./extension
shell: bash
run: mv ./extension/${{ inputs.file-name }} ./extension/quill-${{ inputs.file-name }}

- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ inputs.tag-name }}
# Note: This path is from repo root
# working-directory is not applied
files: ./extension/extension/quill-${{ inputs.file-name }}
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ aggregator:
aggregator-proxy:
- aggregator-proxy/*
- aggregator-proxy/**/*
automation:
- .github/*
- .github/**/*
extension:
- extension/*
- extension/**/*
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/extension-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: extension-release

on:
release:
types: [published]

defaults:
run:
working-directory: ./extension

env:
NODEJS_VERSION: 16.x

jobs:
chrome:
runs-on: ubuntu-latest
environment: extension-release

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-upload-extension
with:
node-version: ${{ env.NODEJS_VERSION }}
browser: chrome
file-name: chrome.zip
tag-name: ${{ github.ref }}

firefox:
runs-on: ubuntu-latest
environment: extension-release

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-upload-extension
with:
node-version: ${{ env.NODEJS_VERSION }}
browser: firefox
file-name: firefox.xpi
tag-name: ${{ github.ref }}

opera:
runs-on: ubuntu-latest
environment: extension-release

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-upload-extension
with:
node-version: ${{ env.NODEJS_VERSION }}
browser: opera
file-name: opera.crx
tag-name: ${{ github.ref }}
2 changes: 0 additions & 2 deletions extension/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PRIVATE_KEY_STORAGE_KEY=default-private-key
AGGREGATOR_URL=http://localhost:3000
DEFAULT_CHAIN_ID=31337
CREATE_TX_URL=
ETHERSCAN_KEY=
CRYPTO_COMPARE_API_KEY=
4 changes: 4 additions & 0 deletions extension/.env.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PRIVATE_KEY_STORAGE_KEY=quill-private-key
AGGREGATOR_URL=https://arbitrum-testnet.blswallet.org
DEFAULT_CHAIN_ID=421611
CRYPTO_COMPARE_API_KEY=injected-from-github-actions-environment
5 changes: 2 additions & 3 deletions extension/source/Controllers/Currency/CurrencyController.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CellCollection from '../../cells/CellCollection';
import ICell from '../../cells/ICell';
import { CRYPTO_COMPARE_API_KEY } from '../../env';
import {
CurrencyControllerConfig,
CurrencyControllerState,
Expand Down Expand Up @@ -49,9 +50,7 @@ export default class CurrencyController {
state = await this.state.read();
const apiUrl = `${
this.config.api
}?fsym=${state.nativeCurrency.toUpperCase()}&tsyms=${state.currentCurrency.toUpperCase()}&api_key=${
process.env.CRYPTO_COMPARE_API_KEY
}`;
}?fsym=${state.nativeCurrency.toUpperCase()}&tsyms=${state.currentCurrency.toUpperCase()}&api_key=${CRYPTO_COMPARE_API_KEY}`;
let response: Response;
try {
response = await fetch(apiUrl);
Expand Down
6 changes: 4 additions & 2 deletions extension/source/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { validateConfig } from 'bls-wallet-clients';
import { requireEnv } from './helpers/envTools';
import toHex from './helpers/toHex';

// export const ETHERSCAN_KEY = requireEnv(process.env.ETHERSCAN_KEY);
export const PRIVATE_KEY_STORAGE_KEY = requireEnv(
process.env.PRIVATE_KEY_STORAGE_KEY,
);
Expand All @@ -11,8 +10,11 @@ export const AGGREGATOR_URL = requireEnv(process.env.AGGREGATOR_URL);
export const DEFAULT_CHAIN_ID_HEX = toHex(
parseInt(requireEnv(process.env.DEFAULT_CHAIN_ID)),
);
export const CREATE_TX_URL = requireEnv(process.env.CREATE_TX_URL);

export const NETWORK_CONFIG = validateConfig(
JSON.parse(requireEnv(process.env.NETWORK_CONFIG)),
);

export const CRYPTO_COMPARE_API_KEY = requireEnv(
process.env.CRYPTO_COMPARE_API_KEY,
);