Compare commits
3 Commits
main
...
atom-payme
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e19a45016 | ||
|
|
273534cc5f | ||
| 2f81e9cc2c |
@ -1,52 +0,0 @@
|
|||||||
name: Deploy from Main
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: '*'
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * 0' # Weekly: Every Sunday at midnight UTC
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
TARGET_REPO: gorbagana-dev/gor-website
|
|
||||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
|
||||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
|
||||||
CERC_REGISTRY_RPC_ENDPOINT: "http://143.198.37.25:26657"
|
|
||||||
CERC_REGISTRY_GQL_ENDPOINT: "http://143.198.37.25:9473/api"
|
|
||||||
CERC_REGISTRY_CHAIN_ID: "laconic-mainnet"
|
|
||||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: gorbagana
|
|
||||||
APP_NAME: "gor-website"
|
|
||||||
DEPLOYER_LRN: "lrn://mito-systems/deployers/webapp-deployer-api.pwa.laconic.audubon.app"
|
|
||||||
AUTHORITY: "mito-systems"
|
|
||||||
|
|
||||||
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: Deploy from main branch
|
|
||||||
run: |
|
|
||||||
# Get latest commit from main branch
|
|
||||||
commit_info=$(curl -s https://api.github.com/repos/${{ env.TARGET_REPO }}/commits/main)
|
|
||||||
commit_hash=$(echo $commit_info | jq -r .sha)
|
|
||||||
commit_date=$(echo $commit_info | jq -r .commit.committer.date)
|
|
||||||
|
|
||||||
echo "Latest commit: $commit_hash"
|
|
||||||
echo "Committed at: $commit_date"
|
|
||||||
echo "Proceeding with deployment"
|
|
||||||
|
|
||||||
# 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.sh ${{ env.TARGET_REPO }} main
|
|
||||||
@ -4,16 +4,16 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: '*'
|
branches: '*'
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * 0' # Weekly: Every Sunday at midnight UTC
|
- cron: '*/10 * * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TARGET_REPO: namada-net/namada-interface
|
TARGET_REPO: anoma/namada-interface
|
||||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
||||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
||||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-mainnet-1.laconic.com"
|
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-sapo.laconic.com"
|
||||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-mainnet-1.laconic.com/api"
|
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-sapo.laconic.com/api"
|
||||||
CERC_REGISTRY_CHAIN_ID: "laconic-mainnet"
|
CERC_REGISTRY_CHAIN_ID: "laconic-testnet-2"
|
||||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: namadillo
|
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: namadillo
|
||||||
APP_NAME: "namada-interface"
|
APP_NAME: "namada-interface"
|
||||||
DEPLOYER_LRN: "lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io"
|
DEPLOYER_LRN: "lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io"
|
||||||
@ -38,16 +38,26 @@ jobs:
|
|||||||
latest_tag=$(echo $latest | jq -r .tag_name)
|
latest_tag=$(echo $latest | jq -r .tag_name)
|
||||||
published_at=$(echo $latest | jq -r .published_at)
|
published_at=$(echo $latest | jq -r .published_at)
|
||||||
|
|
||||||
|
current_time=$(date -u +%s)
|
||||||
|
release_time=$(date -u -d "$published_at" +%s)
|
||||||
|
time_diff=$((current_time - release_time))
|
||||||
|
|
||||||
echo "Latest tag: $latest_tag"
|
echo "Latest tag: $latest_tag"
|
||||||
echo "Published at: $published_at"
|
echo "Published at: $published_at"
|
||||||
|
echo "Time diff: $time_diff"
|
||||||
|
|
||||||
echo "Proceeding with deployment"
|
# Only proceed if release is recent
|
||||||
|
if [ $time_diff -le 600 ]; then
|
||||||
# Setup dependencies
|
echo "Recent release detected - proceeding with deployment"
|
||||||
sudo apt -y update && sudo apt -y install jq
|
|
||||||
corepack enable
|
# Setup dependencies
|
||||||
npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
sudo apt -y update && sudo apt -y install jq
|
||||||
npm install -g @cerc-io/laconic-registry-cli
|
corepack enable
|
||||||
|
npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||||
# Run deployment
|
npm install -g @cerc-io/laconic-registry-cli
|
||||||
./deploy.sh ${{ env.TARGET_REPO }} $latest_tag
|
|
||||||
|
# Run deployment
|
||||||
|
./deploy.sh ${{ env.TARGET_REPO }} $latest_tag
|
||||||
|
else
|
||||||
|
echo "No recent release - skipping deployment"
|
||||||
|
fi
|
||||||
|
|||||||
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
|
||||||
63
.gitea/workflows/deploy-skip.yml
Normal file
63
.gitea/workflows/deploy-skip.yml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
name: Check Latest Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: '*'
|
||||||
|
schedule:
|
||||||
|
- cron: '*/5 * * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
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-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"
|
||||||
|
AUTHORITY: "vaasl"
|
||||||
|
|
||||||
|
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)
|
||||||
|
published_at=$(echo $latest | jq -r .published_at)
|
||||||
|
|
||||||
|
current_time=$(date -u +%s)
|
||||||
|
release_time=$(date -u -d "$published_at" +%s)
|
||||||
|
time_diff=$((current_time - release_time))
|
||||||
|
|
||||||
|
echo "Latest tag: $latest_tag"
|
||||||
|
echo "Published at: $published_at"
|
||||||
|
echo "Time diff: $time_diff"
|
||||||
|
|
||||||
|
# Only proceed if release is recent
|
||||||
|
if [ $time_diff -le 300 ]; then
|
||||||
|
echo "Recent release detected - proceeding with deployment"
|
||||||
|
|
||||||
|
# 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.sh ${{ env.TARGET_REPO }} $latest_tag
|
||||||
|
else
|
||||||
|
echo "No recent release - skipping deployment"
|
||||||
|
fi
|
||||||
@ -1,53 +0,0 @@
|
|||||||
name: Deploy from Main
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * 0' # Weekly: Every Sunday at midnight UTC
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
TARGET_REPO: zramsay/zenith-docs
|
|
||||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
|
||||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
|
||||||
CERC_REGISTRY_RPC_ENDPOINT: "http://143.198.37.25:26657"
|
|
||||||
CERC_REGISTRY_GQL_ENDPOINT: "http://143.198.37.25:9473/api"
|
|
||||||
CERC_REGISTRY_CHAIN_ID: "laconic-mainnet"
|
|
||||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: zenith-docs
|
|
||||||
APP_NAME: "zenith-docs"
|
|
||||||
DEPLOYER_LRN: "lrn://mito-systems/deployers/webapp-deployer-api.pwa.laconic.audubon.app"
|
|
||||||
AUTHORITY: "mito-systems"
|
|
||||||
|
|
||||||
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: Deploy from docs-mvp branch
|
|
||||||
run: |
|
|
||||||
# Get latest commit from docs-mvp branch
|
|
||||||
commit_info=$(curl -s https://git.vdb.to/api/v1/repos/${{ env.TARGET_REPO }}/branches/docs-mvp)
|
|
||||||
commit_hash=$(echo $commit_info | jq -r .commit.id)
|
|
||||||
commit_date=$(echo $commit_info | jq -r .commit.timestamp)
|
|
||||||
|
|
||||||
echo "Latest commit: $commit_hash"
|
|
||||||
echo "Committed at: $commit_date"
|
|
||||||
echo "Proceeding with deployment"
|
|
||||||
|
|
||||||
# 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-gitea.sh ${{ env.TARGET_REPO }} docs-mvp
|
|
||||||
@ -3,10 +3,12 @@
|
|||||||
# Exit on any error
|
# Exit on any error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Trigger
|
||||||
|
|
||||||
# Check for required positional arguments
|
# Check for required positional arguments
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Error: Two arguments required"
|
echo "Error: Two arguments required"
|
||||||
echo "Usage: $0 <owner/repo> <branch-or-tag>"
|
echo "Usage: $0 <owner/repo> <tag>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -22,30 +24,18 @@ if [ -z "$CERC_REGISTRY_BOND_ID" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
REPO_PATH="$1"
|
REPO_PATH="$1"
|
||||||
REF="$2"
|
TAG="$2"
|
||||||
REPO="https://git.vdb.to/${REPO_PATH}"
|
REPO="https://github.com/${REPO_PATH}"
|
||||||
|
|
||||||
# Get the commit hash - try as branch first, then as tag
|
# Get the commit hash for the tag using GitHub API
|
||||||
COMMIT_HASH=$(curl -s "https://git.vdb.to/api/v1/repos/${REPO_PATH}/branches/${REF}" | jq -r '.commit.id')
|
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
|
if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then
|
||||||
# Fall back to tag lookup
|
echo "Error: Could not find commit hash for tag $TAG"
|
||||||
COMMIT_HASH=$(curl -s "https://git.vdb.to/api/v1/repos/${REPO_PATH}/tags/${REF}" | jq -r '.commit.sha')
|
exit 1
|
||||||
if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then
|
|
||||||
echo "Error: Could not find commit hash for ref $REF"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use short commit hash for version
|
|
||||||
SHORT_HASH="${COMMIT_HASH:0:7}"
|
|
||||||
VERSION="${REF}-${SHORT_HASH}"
|
|
||||||
|
|
||||||
echo "Deploying from ref: $REF"
|
|
||||||
echo "Commit hash: $COMMIT_HASH"
|
|
||||||
echo "Version: $VERSION"
|
|
||||||
|
|
||||||
# Create temporary files
|
# Create temporary files
|
||||||
RECORD_FILE=tmp.rf.$
|
RECORD_FILE=tmp.rf.$$
|
||||||
CONFIG_FILE=$(mktemp)
|
CONFIG_FILE=$(mktemp)
|
||||||
|
|
||||||
# Generate registry configuration
|
# Generate registry configuration
|
||||||
@ -64,7 +54,7 @@ cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
|||||||
record:
|
record:
|
||||||
type: ApplicationRecord
|
type: ApplicationRecord
|
||||||
name: "$APP_NAME"
|
name: "$APP_NAME"
|
||||||
version: "$VERSION"
|
version: "$TAG"
|
||||||
app_type: webapp
|
app_type: webapp
|
||||||
repository:
|
repository:
|
||||||
- "$REPO"
|
- "$REPO"
|
||||||
@ -88,25 +78,11 @@ 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" "$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"
|
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
|
||||||
|
|
||||||
# Handle deployer payment if required
|
# Generate deployment request
|
||||||
if [ ! -z "$DEPLOYER_LRN" ]; then
|
echo "Generating deployment request..."
|
||||||
echo "Processing deployer payment..."
|
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||||
paymentAddress=$(laconic -c $CONFIG_FILE registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.paymentAddress')
|
|
||||||
paymentAmount=$(laconic -c $CONFIG_FILE registry name resolve "$DEPLOYER_LRN" | jq -r '.[0].attributes.minimumPayment' | sed 's/alnt//g')
|
|
||||||
|
|
||||||
if [[ -n "$paymentAmount" && "$paymentAmount" != "null" ]]; then
|
|
||||||
payment=$(laconic -c $CONFIG_FILE registry tokens send --address "$paymentAddress" --type alnt --quantity "$paymentAmount" --user-key "$CERC_REGISTRY_USER_KEY" --bond-id "$CERC_REGISTRY_BOND_ID")
|
|
||||||
txHash=$(echo "$payment" | jq -r '.tx.hash')
|
|
||||||
echo "Paid deployer with txHash: $txHash"
|
|
||||||
else
|
|
||||||
echo "No payment required - skipping payment step"
|
|
||||||
txHash=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate deployment request
|
|
||||||
echo "Generating deployment request..."
|
|
||||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
|
||||||
record:
|
record:
|
||||||
type: ApplicationDeploymentRequest
|
type: ApplicationDeploymentRequest
|
||||||
version: '1.0.0'
|
version: '1.0.0'
|
||||||
@ -121,16 +97,15 @@ record:
|
|||||||
note: "Added by CI @ $(date)"
|
note: "Added by CI @ $(date)"
|
||||||
repository: "$REPO"
|
repository: "$REPO"
|
||||||
repository_ref: "$COMMIT_HASH"
|
repository_ref: "$COMMIT_HASH"
|
||||||
payment: $txHash
|
payment: FB3968A92E605872B57FC80864E1530BD7DCEFD7CE9BD14EF76698B5A2EF9742
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat $RECORD_FILE
|
cat $RECORD_FILE
|
||||||
DEPLOY_RECORD_ID=$(laconic -c $CONFIG_FILE registry record publish \
|
DEPLOY_RECORD_ID=$(laconic -c $CONFIG_FILE registry record publish \
|
||||||
--filename $RECORD_FILE \
|
--filename $RECORD_FILE \
|
||||||
--user-key "${CERC_REGISTRY_USER_KEY}" \
|
--user-key "${CERC_REGISTRY_USER_KEY}" \
|
||||||
--bond-id ${CERC_REGISTRY_BOND_ID} | jq -r '.id')
|
--bond-id ${CERC_REGISTRY_BOND_ID} | jq -r '.id')
|
||||||
echo "Deployment Record ID: $DEPLOY_RECORD_ID"
|
echo "Deployment Record ID: $DEPLOY_RECORD_ID"
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f $RECORD_FILE $CONFIG_FILE
|
rm -f $RECORD_FILE $CONFIG_FILE
|
||||||
38
deploy.sh
38
deploy.sh
@ -3,10 +3,12 @@
|
|||||||
# Exit on any error
|
# Exit on any error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Trigger
|
||||||
|
|
||||||
# Check for required positional arguments
|
# Check for required positional arguments
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Error: Two arguments required"
|
echo "Error: Two arguments required"
|
||||||
echo "Usage: $0 <owner/repo> <branch-or-tag>"
|
echo "Usage: $0 <owner/repo> <tag>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -22,28 +24,16 @@ if [ -z "$CERC_REGISTRY_BOND_ID" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
REPO_PATH="$1"
|
REPO_PATH="$1"
|
||||||
REF="$2"
|
TAG="$2"
|
||||||
REPO="https://github.com/${REPO_PATH}"
|
REPO="https://github.com/${REPO_PATH}"
|
||||||
|
|
||||||
# Get the commit hash - try as branch first, then as tag
|
# Get the commit hash for the tag using GitHub API
|
||||||
COMMIT_HASH=$(curl -s "https://api.github.com/repos/${REPO_PATH}/commits/${REF}" | jq -r '.sha')
|
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
|
if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then
|
||||||
# Fall back to tag lookup
|
echo "Error: Could not find commit hash for tag $TAG"
|
||||||
COMMIT_HASH=$(curl -s "https://api.github.com/repos/${REPO_PATH}/git/refs/tags/${REF}" | jq -r '.object.sha')
|
exit 1
|
||||||
if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then
|
|
||||||
echo "Error: Could not find commit hash for ref $REF"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use short commit hash for version
|
|
||||||
SHORT_HASH="${COMMIT_HASH:0:7}"
|
|
||||||
VERSION="${REF}-${SHORT_HASH}"
|
|
||||||
|
|
||||||
echo "Deploying from ref: $REF"
|
|
||||||
echo "Commit hash: $COMMIT_HASH"
|
|
||||||
echo "Version: $VERSION"
|
|
||||||
|
|
||||||
# Create temporary files
|
# Create temporary files
|
||||||
RECORD_FILE=tmp.rf.$$
|
RECORD_FILE=tmp.rf.$$
|
||||||
CONFIG_FILE=$(mktemp)
|
CONFIG_FILE=$(mktemp)
|
||||||
@ -64,7 +54,7 @@ cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
|||||||
record:
|
record:
|
||||||
type: ApplicationRecord
|
type: ApplicationRecord
|
||||||
name: "$APP_NAME"
|
name: "$APP_NAME"
|
||||||
version: "$VERSION"
|
version: "$TAG"
|
||||||
app_type: webapp
|
app_type: webapp
|
||||||
repository:
|
repository:
|
||||||
- "$REPO"
|
- "$REPO"
|
||||||
@ -102,11 +92,11 @@ if [ ! -z "$DEPLOYER_LRN" ]; then
|
|||||||
else
|
else
|
||||||
echo "No payment required - skipping payment step"
|
echo "No payment required - skipping payment step"
|
||||||
txHash=""
|
txHash=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate deployment request
|
# Generate deployment request
|
||||||
echo "Generating deployment request..."
|
echo "Generating deployment request..."
|
||||||
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
cat <<EOF | sed '/.*: ""$/d' > "$RECORD_FILE"
|
||||||
record:
|
record:
|
||||||
type: ApplicationDeploymentRequest
|
type: ApplicationDeploymentRequest
|
||||||
version: '1.0.0'
|
version: '1.0.0'
|
||||||
@ -134,4 +124,4 @@ fi
|
|||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f $RECORD_FILE $CONFIG_FILE
|
rm -f $RECORD_FILE $CONFIG_FILE
|
||||||
echo "Script completed successfully"
|
echo "Script completed successfully"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user