Skip to content

Commit ae25303

Browse files
authored
Merge pull request #760 from Adamant-im/feature/adm-testnet-nodes
Feat: Add Github Workflow build with testnet ADM nodes
2 parents 3ad4b7b + a709f44 commit ae25303

File tree

9 files changed

+428
-245
lines changed

9 files changed

+428
-245
lines changed

.github/workflows/pwa-testnet.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: PWA Testnet Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
env:
9+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
10+
PREVIEW_DOMAIN: https://msg-adamant-pr-testnet.surge.sh
11+
12+
jobs:
13+
build-and-deploy-to-surge:
14+
name: Build and Deploy with Testnet ADM nodes to surge
15+
runs-on: ubuntu-latest
16+
environment: testing
17+
permissions:
18+
pull-requests: write
19+
steps:
20+
- name: Checkout repository 🛎️
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node version 🍀
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
28+
- name: Install dependencies ⚙️
29+
run: npm ci
30+
31+
- name: Build PWA 🛠️
32+
run: |
33+
npm run schema:generate
34+
npm run build:testnet
35+
36+
- name: Archive artifacts 📁
37+
uses: actions/upload-artifact@v4
38+
with:
39+
path: dist
40+
41+
- name: Deploy to surge 🚀
42+
run: |
43+
npm install --global surge
44+
surge ./dist ${{ env.PREVIEW_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }}
45+
46+
- name: Comment PR 💬
47+
uses: thollander/actions-comment-pull-request@v2
48+
with:
49+
message: |
50+
Deployed to ${{ env.PREVIEW_DOMAIN }} 🚀
51+
comment_tag: deploy-message

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
"serve": "vite preview --config vite-pwa.config.ts",
1111
"dev": "vite --config vite-pwa.config.ts",
1212
"dev:localnet": "vite --host 0.0.0.0 --config vite-pwa.config.ts",
13-
"serve:test": "cross-env ADM_CONFIG_FILE=test vue-cli-service serve",
13+
"dev:testnet": "vite --config vite-pwa.config.ts --mode testnet",
14+
"dev:tor": "vite --config vite-pwa.config.ts --mode tor",
1415
"wallets:generate": "npm run wallets:data:generate && npm run wallets:types:generate",
1516
"wallets:data:generate": "node scripts/wallets.mjs",
1617
"wallets:types:generate": "swagger-typescript-api -p ./adamant-wallets/specification/openapi.json -o ./src/types/wallets -n index.ts --no-client",
1718
"build": "vue-tsc && vite build --config vite-pwa.config.ts",
19+
"build:testnet": "vue-tsc && vite build --config vite-pwa.config.ts --mode testnet",
20+
"build:tor": "vue-tsc && vite build --config vite-pwa.config.ts --mode tor",
1821
"lint": "eslint --ext .ts,.js,.vue --fix ./src",
1922
"prettify": "prettier --write src/",
2023
"typecheck": "vue-tsc --noEmit",

scripts/wallets.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ async function run(branch = 'master') {
3333

3434
await updateProductionConfig(config)
3535
await updateDevelopmentConfig(config)
36+
await updateTestnetConfig(config)
3637
await updateTorConfig(config)
3738

3839
console.log('Coins updated successfully')
@@ -152,6 +153,16 @@ function updateDevelopmentConfig(configs) {
152153
return updateConfig(configs, 'development')
153154
}
154155

156+
function updateTestnetConfig(configs) {
157+
const testnetConfigs = _.mapValues(configs, (config) => {
158+
if (config.testnet) config.nodes.list = config.testnet.nodes.list
159+
160+
return config
161+
});
162+
163+
return updateConfig(testnetConfigs, 'testnet')
164+
}
165+
155166
function updateTorConfig(configs) {
156167
const torConfigs = _.mapValues(configs, (config) => {
157168
const torConfig = _.mergeWith(config, config.tor, (value, srcValue) => {

src/config/development.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"list": [
8888
{
8989
"url": "https://info.adamant.im",
90-
"alt_ip": "http://88.198.156.44:44099"
90+
"alt_ip": "http://5.161.98.136:33088"
9191
},
9292
{
9393
"url": "https://info2.adm.im",

src/config/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import devConfig from './development.json'
22
import prodConfig from './production.json'
3-
import testingConfig from './test.json'
3+
import testnetConfig from './testnet.json'
44
import torConfig from './tor.json'
55

66
const configMap = {
77
development: devConfig,
88
production: prodConfig,
9-
test: testingConfig,
9+
testnet: testnetConfig,
1010
tor: torConfig
1111
}
1212

13-
const configName = import.meta.env.MODE || import.meta.env.ADM_CONFIG_FILE
13+
const configName = import.meta.env.MODE
1414

1515
export default configMap[configName]

src/config/production.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"list": [
8787
{
8888
"url": "https://info.adamant.im",
89-
"alt_ip": "http://88.198.156.44:44099"
89+
"alt_ip": "http://5.161.98.136:33088"
9090
},
9191
{
9292
"url": "https://info2.adm.im",

src/config/test.json

Lines changed: 0 additions & 235 deletions
This file was deleted.

0 commit comments

Comments
 (0)