forked from cerc-io/cosmos-explorer
testnet deploy
This commit is contained in:
parent
fe96cd224c
commit
3136964430
21
.github/workflows/config-check.yaml
vendored
21
.github/workflows/config-check.yaml
vendored
@ -1,21 +0,0 @@
|
||||
|
||||
name: Config Checker
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [ master ]
|
||||
pull_request:
|
||||
# branches: [ master ]
|
||||
paths:
|
||||
- 'chains/mainnet/**'
|
||||
- 'chains/testnet/**'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Check Blockchain Config
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git Checkout Latest
|
||||
uses: actions/checkout@v3
|
||||
- name: Check Chain Configs
|
||||
uses: ping-pub/ping-dashboard-config-checker@v1.0
|
51
.github/workflows/docker.yaml
vendored
51
.github/workflows/docker.yaml
vendored
@ -1,51 +0,0 @@
|
||||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master-backup'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
# -
|
||||
# name: Set up QEMU
|
||||
# uses: docker/setup-qemu-action@v1
|
||||
# -
|
||||
# name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v1
|
||||
- name: Install
|
||||
run: yarn install
|
||||
- name: Build
|
||||
run: yarn run vue-cli-service build
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
yaoling/wallet
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=sha
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
28
.github/workflows/mainnet-deploy.yaml.disabled
vendored
28
.github/workflows/mainnet-deploy.yaml.disabled
vendored
@ -1,28 +0,0 @@
|
||||
|
||||
name: Deploy to ping.pub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master2 ]
|
||||
# pull_request:
|
||||
# branches: [ master ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Ping deploy
|
||||
runs-on: mainnet
|
||||
steps:
|
||||
- name: Environment
|
||||
run: export NODE_OPTIONS="--max_old_space_size=4096"
|
||||
|
||||
- name: Git Checkout Latest
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install
|
||||
run: yarn install --ignore-engines
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
|
||||
- name: Deploy
|
||||
run: cp -rf ./dist/* /var/www/html/
|
39
.github/workflows/publish.yaml
vendored
Normal file
39
.github/workflows/publish.yaml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Publish ApplicationRecord to Registry
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '*'
|
||||
|
||||
env:
|
||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_VAASL_LACONIC_USER_KEY }}
|
||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_VAASL_LACONIC_BOND_ID }}
|
||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: ${{ vars.CERC_REGISTRY_DEPLOYMENT_HOSTNAME }}
|
||||
CERC_REGISTRY_DEPLOYMENT_REQUEST_USER_KEY: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_USER_KEY }}
|
||||
CERC_REGISTRY_DEPLOYMENT_REQUEST_BOND_ID: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_BOND_ID }}
|
||||
CERC_REGISTRY_DEPLOYMENT_REQUEST_PAYMENT_TO: ${{ secrets.CICD_VAASL_DEPLOYMENT_REQUEST_PAYMENT_TO }}
|
||||
|
||||
jobs:
|
||||
cns_publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
- name: "Enable Yarn"
|
||||
run: corepack enable
|
||||
- name: "Install registry CLI"
|
||||
run: |
|
||||
npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
npm install -g @cerc-io/laconic-registry-cli
|
||||
- name: "Install jq"
|
||||
run: apt -y update && apt -y install jq
|
||||
- name: "Publish Application Record"
|
||||
run: scripts/publish-app-record.sh
|
||||
- name: "Request Deployment"
|
||||
run: scripts/request-app-deployment.sh
|
27
.github/workflows/testnet-deploy.yaml
vendored
27
.github/workflows/testnet-deploy.yaml
vendored
@ -1,27 +0,0 @@
|
||||
|
||||
name: Testnet Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ testnet ]
|
||||
pull_request:
|
||||
branches: [ testnet ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Ping deploy
|
||||
runs-on: testnet
|
||||
steps:
|
||||
- name: print
|
||||
run: echo ${GITHUB_REF#refs/heads/}
|
||||
- name: Git Checkout Latest
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install
|
||||
run: yarn install
|
||||
|
||||
- name: Build
|
||||
run: yarn run vue-cli-service build
|
||||
|
||||
- name: Deploy
|
||||
run: cp -rf ./dist/* /var/www/html/
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "ping.pub",
|
||||
"name": "@lcn-demo/ping.pub",
|
||||
"version": "3.0.0",
|
||||
"repository": "https://git.vdb.to/zramsay/cosmos-explorer",
|
||||
"private": true,
|
||||
"target": "",
|
||||
"scripts": {
|
||||
|
69
scripts/publish-app-record.sh
Executable file
69
scripts/publish-app-record.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
RECORD_FILE=tmp.rf.$$
|
||||
CONFIG_FILE=`mktemp`
|
||||
|
||||
CERC_APP_TYPE=${CERC_APP_TYPE:-"webapp/next"}
|
||||
CERC_REPO_REF=${CERC_REPO_REF:-${GITHUB_SHA:-`git log -1 --format="%H"`}}
|
||||
CERC_IS_LATEST_RELEASE=${CERC_IS_LATEST_RELEASE:-"true"}
|
||||
|
||||
rcd_name=$(jq -r '.name' package.json | sed 's/null//')
|
||||
rcd_desc=$(jq -r '.description' package.json | sed 's/null//')
|
||||
rcd_repository=$(jq -r '.repository' package.json | sed 's/null//')
|
||||
rcd_homepage=$(jq -r '.homepage' package.json | sed 's/null//')
|
||||
rcd_license=$(jq -r '.license' package.json | sed 's/null//')
|
||||
rcd_author=$(jq -r '.author' package.json | sed 's/null//')
|
||||
rcd_app_version=$(jq -r '.version' package.json | sed 's/null//')
|
||||
|
||||
cat <<EOF > "$CONFIG_FILE"
|
||||
services:
|
||||
registry:
|
||||
rpcEndpoint: '${CERC_REGISTRY_RPC_ENDPOINT:-https://laconicd.laconic.com}'
|
||||
gqlEndpoint: '${CERC_REGISTRY_GQL_ENDPOINT:-https://laconicd.laconic.com/api}'
|
||||
chainId: ${CERC_REGISTRY_CHAIN_ID:-laconic_9000-1}
|
||||
gas: 900000
|
||||
fees: 1900000alnt
|
||||
EOF
|
||||
|
||||
next_ver=$(laconic -c $CONFIG_FILE registry record list --type ApplicationRecord --all --name "$rcd_name" 2>/dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$CERC_REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||
|
||||
if [ -z "$next_ver" ] || [ "1" == "$next_ver" ]; then
|
||||
next_ver=0.0.1
|
||||
fi
|
||||
|
||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||
record:
|
||||
type: ApplicationRecord
|
||||
version: ${next_ver}
|
||||
name: "$rcd_name"
|
||||
description: "$rcd_desc"
|
||||
homepage: "$rcd_homepage"
|
||||
license: "$rcd_license"
|
||||
author: "$rcd_author"
|
||||
repository:
|
||||
- "$rcd_repository"
|
||||
repository_ref: "$CERC_REPO_REF"
|
||||
app_version: "$rcd_app_version"
|
||||
app_type: "$CERC_APP_TYPE"
|
||||
EOF
|
||||
|
||||
|
||||
cat $RECORD_FILE
|
||||
RECORD_ID=$(laconic -c $CONFIG_FILE registry record publish --filename $RECORD_FILE --user-key "${CERC_REGISTRY_USER_KEY}" --bond-id ${CERC_REGISTRY_BOND_ID} | jq -r '.id')
|
||||
echo $RECORD_ID
|
||||
|
||||
if [ -z "$CERC_REGISTRY_APP_LRN" ]; then
|
||||
authority=$(echo "$rcd_name" | cut -d'/' -f1 | sed 's/@//')
|
||||
app=$(echo "$rcd_name" | cut -d'/' -f2-)
|
||||
CERC_REGISTRY_APP_LRN="lrn://$authority/applications/$app"
|
||||
fi
|
||||
|
||||
laconic -c $CONFIG_FILE registry name set --user-key "${CERC_REGISTRY_USER_KEY}" --bond-id ${CERC_REGISTRY_BOND_ID} "$CERC_REGISTRY_APP_LRN@${rcd_app_version}" "$RECORD_ID"
|
||||
laconic -c $CONFIG_FILE registry name set --user-key "${CERC_REGISTRY_USER_KEY}" --bond-id ${CERC_REGISTRY_BOND_ID} "$CERC_REGISTRY_APP_LRN@${CERC_REPO_REF}" "$RECORD_ID"
|
||||
if [ "true" == "$CERC_IS_LATEST_RELEASE" ]; then
|
||||
laconic -c $CONFIG_FILE registry name set --user-key "${CERC_REGISTRY_USER_KEY}" --bond-id ${CERC_REGISTRY_BOND_ID} "$CERC_REGISTRY_APP_LRN" "$RECORD_ID"
|
||||
fi
|
||||
|
||||
rm -f $RECORD_FILE $CONFIG_FILE
|
67
scripts/request-app-deployment.sh
Executable file
67
scripts/request-app-deployment.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
RECORD_FILE=tmp.rf.$$
|
||||
CONFIG_FILE=`mktemp`
|
||||
|
||||
rcd_name=$(jq -r '.name' package.json | sed 's/null//' | sed 's/^@//')
|
||||
rcd_app_version=$(jq -r '.version' package.json | sed 's/null//')
|
||||
|
||||
cat <<EOF > "$CONFIG_FILE"
|
||||
services:
|
||||
registry:
|
||||
rpcEndpoint: '${CERC_REGISTRY_RPC_ENDPOINT:-https://laconicd.laconic.com}'
|
||||
gqlEndpoint: '${CERC_REGISTRY_GQL_ENDPOINT:-https://laconicd.laconic.com/api}'
|
||||
chainId: ${CERC_REGISTRY_CHAIN_ID:-laconic_9000-1}
|
||||
gas: 900000
|
||||
fees: 900000alnt
|
||||
EOF
|
||||
|
||||
if [ -z "$CERC_REGISTRY_APP_LRN" ]; then
|
||||
authority=$(echo "$rcd_name" | cut -d'/' -f1 | sed 's/@//')
|
||||
app=$(echo "$rcd_name" | cut -d'/' -f2-)
|
||||
CERC_REGISTRY_APP_LRN="lrn://$authority/applications/$app"
|
||||
fi
|
||||
|
||||
PAYMENT_TX=$(laconic -c $CONFIG_FILE registry tokens send \
|
||||
--address laconic13eq42rat3aurnfj6pu32yl00zyhl8sent97efe \
|
||||
--user-key "${CERC_REGISTRY_DEPLOYMENT_REQUEST_USER_KEY}" \
|
||||
--bond-id "${CERC_REGISTRY_DEPLOYMENT_REQUEST_BOND_ID}" \
|
||||
--type alnt \
|
||||
--quantity ${CERC_REGISTRY_DEPLOYMENT_REQUEST_PAYMENT_AMOUNT:-10000} | jq '.tx.hash')
|
||||
|
||||
APP_RECORD=$(laconic -c $CONFIG_FILE registry name resolve "$CERC_REGISTRY_APP_LRN" | jq '.[0]')
|
||||
if [ -z "$APP_RECORD" ] || [ "null" == "$APP_RECORD" ]; then
|
||||
echo "No record found for $CERC_REGISTRY_APP_LRN."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||
record:
|
||||
type: ApplicationDeploymentRequest
|
||||
version: 1.0.0
|
||||
name: "$rcd_name@$rcd_app_version"
|
||||
application: "$CERC_REGISTRY_APP_LRN@$rcd_app_version"
|
||||
dns: "$CERC_REGISTRY_DEPLOYMENT_HOSTNAME"
|
||||
deployment: "$CERC_REGISTRY_DEPLOYMENT_LRN"
|
||||
to: laconic13eq42rat3aurnfj6pu32yl00zyhl8sent97efe
|
||||
payment: $PAYMENT_TX
|
||||
config:
|
||||
env:
|
||||
CERC_WEBAPP_DEBUG: "$rcd_app_version"
|
||||
meta:
|
||||
note: "Added by CI @ `date`"
|
||||
repository: "`git remote get-url origin`"
|
||||
repository_ref: "${GITHUB_SHA:-`git log -1 --format="%H"`}"
|
||||
EOF
|
||||
|
||||
|
||||
cat $RECORD_FILE
|
||||
RECORD_ID=$(laconic -c $CONFIG_FILE registry record publish \
|
||||
--filename $RECORD_FILE \
|
||||
--user-key "${CERC_REGISTRY_DEPLOYMENT_REQUEST_USER_KEY}" \
|
||||
--bond-id ${CERC_REGISTRY_DEPLOYMENT_REQUEST_BOND_ID} | jq -r '.id')
|
||||
echo $RECORD_ID
|
||||
|
||||
rm -f $RECORD_FILE $CONFIG_FILE
|
Loading…
Reference in New Issue
Block a user