Compare commits
3 Commits
main
...
atom-payme
Author | SHA1 | Date | |
---|---|---|---|
|
9e19a45016 | ||
|
273534cc5f | ||
2f81e9cc2c |
@ -11,9 +11,9 @@ env:
|
||||
TARGET_REPO: anoma/namada-interface
|
||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-mainnet-1.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-mainnet-1.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-mainnet"
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-sapo.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-sapo.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-testnet-2"
|
||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: namadillo
|
||||
APP_NAME: "namada-interface"
|
||||
DEPLOYER_LRN: "lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io"
|
||||
|
46
.gitea/workflows/deploy-skip-atom.yml
Normal file
46
.gitea/workflows/deploy-skip-atom.yml
Normal file
@ -0,0 +1,46 @@
|
||||
name: Check Latest Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
TARGET_REPO: LaconicNetwork/skip-go-app
|
||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
||||
CERC_REGISTRY_BOND_ID: e2271e59c85b500f97d7efcef320e7ebf5c470f1580d4479302ba20b32624adc
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-sapo.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-sapo.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-testnet-2"
|
||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: skip-go-build
|
||||
APP_NAME: "skip-go-build"
|
||||
DEPLOYER_LRN: "lrn://atom/deployers/webapp-deployer-api.pwa.atom.audubon.app"
|
||||
AUTHORITY: "atom"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
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: Get latest release and deploy
|
||||
run: |
|
||||
# Get release info
|
||||
latest=$(curl -s https://api.github.com/repos/${{ env.TARGET_REPO }}/releases/latest)
|
||||
latest_tag=$(echo $latest | jq -r .tag_name)
|
||||
|
||||
|
||||
# Setup dependencies
|
||||
sudo apt -y update && sudo apt -y install jq
|
||||
corepack enable
|
||||
npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
npm install -g @cerc-io/laconic-registry-cli
|
||||
|
||||
# Run deployment
|
||||
./deploy-atom.sh ${{ env.TARGET_REPO }} $latest_tag
|
@ -11,9 +11,9 @@ env:
|
||||
TARGET_REPO: LaconicNetwork/skip-go-app
|
||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-mainnet-1.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-mainnet-1.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-mainnet"
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-sapo.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-sapo.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-testnet-2"
|
||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: skip-go-build
|
||||
APP_NAME: "skip-go-build"
|
||||
DEPLOYER_LRN: "lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io"
|
||||
|
112
deploy-atom.sh
Executable file
112
deploy-atom.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
|
||||
# Trigger
|
||||
|
||||
# Check for required positional arguments
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Error: Two arguments required"
|
||||
echo "Usage: $0 <owner/repo> <tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check required environment variables
|
||||
if [ -z "$CERC_REGISTRY_USER_KEY" ]; then
|
||||
echo "Error: CERC_REGISTRY_USER_KEY environment variable is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CERC_REGISTRY_BOND_ID" ]; then
|
||||
echo "Error: CERC_REGISTRY_BOND_ID environment variable is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_PATH="$1"
|
||||
TAG="$2"
|
||||
REPO="https://github.com/${REPO_PATH}"
|
||||
|
||||
# Get the commit hash for the tag using GitHub API
|
||||
COMMIT_HASH=$(curl -s "https://api.github.com/repos/${REPO_PATH}/git/refs/tags/${TAG}" | jq -r '.object.sha')
|
||||
if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then
|
||||
echo "Error: Could not find commit hash for tag $TAG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create temporary files
|
||||
RECORD_FILE=tmp.rf.$$
|
||||
CONFIG_FILE=$(mktemp)
|
||||
|
||||
# Generate registry configuration
|
||||
cat <<EOF > "$CONFIG_FILE"
|
||||
services:
|
||||
registry:
|
||||
rpcEndpoint: '${CERC_REGISTRY_RPC_ENDPOINT}'
|
||||
gqlEndpoint: '${CERC_REGISTRY_GQL_ENDPOINT}'
|
||||
chainId: ${CERC_REGISTRY_CHAIN_ID}
|
||||
gas: 900000
|
||||
fees: 900000alnt
|
||||
EOF
|
||||
|
||||
# Generate the application record
|
||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||
record:
|
||||
type: ApplicationRecord
|
||||
name: "$APP_NAME"
|
||||
version: "$TAG"
|
||||
app_type: webapp
|
||||
repository:
|
||||
- "$REPO"
|
||||
repository_ref: "$COMMIT_HASH"
|
||||
app_version: "0.0.1"
|
||||
EOF
|
||||
|
||||
# Publish the application record
|
||||
echo "Publishing application record..."
|
||||
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: $RECORD_ID"
|
||||
|
||||
# Set up LRN (Laconic Resource Name)
|
||||
if [ -z "$CERC_REGISTRY_APP_LRN" ]; then
|
||||
CERC_REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/$APP_NAME"
|
||||
fi
|
||||
|
||||
# Set name mappings
|
||||
echo "Setting name mappings..."
|
||||
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"
|
||||
laconic -c $CONFIG_FILE registry name set --user-key "${CERC_REGISTRY_USER_KEY}" --bond-id ${CERC_REGISTRY_BOND_ID} "$CERC_REGISTRY_APP_LRN@${COMMIT_HASH}" "$RECORD_ID"
|
||||
|
||||
## TODO manually enter a txhash after sending atom
|
||||
|
||||
# Generate deployment request
|
||||
echo "Generating deployment request..."
|
||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||
record:
|
||||
type: ApplicationDeploymentRequest
|
||||
version: '1.0.0'
|
||||
name: "$APP_NAME"
|
||||
application: "$CERC_REGISTRY_APP_LRN"
|
||||
deployer: $DEPLOYER_LRN
|
||||
dns: $CERC_REGISTRY_DEPLOYMENT_HOSTNAME
|
||||
config:
|
||||
env:
|
||||
LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2
|
||||
meta:
|
||||
note: "Added by CI @ $(date)"
|
||||
repository: "$REPO"
|
||||
repository_ref: "$COMMIT_HASH"
|
||||
payment: FB3968A92E605872B57FC80864E1530BD7DCEFD7CE9BD14EF76698B5A2EF9742
|
||||
EOF
|
||||
|
||||
cat $RECORD_FILE
|
||||
DEPLOY_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 "Deployment Record ID: $DEPLOY_RECORD_ID"
|
||||
|
||||
# Cleanup
|
||||
rm -f $RECORD_FILE $CONFIG_FILE
|
||||
echo "Script completed successfully"
|
Loading…
Reference in New Issue
Block a user