Skip to content

Commit 2858abd

Browse files
committed
ci: migrate deploy to HANZO_API_KEY + KMS
Replace direct DIGITALOCEAN_ACCESS_TOKEN with KMS credential fetch using HANZO_API_KEY for multi-network explorer deployment to lux-k8s.
1 parent 902d246 commit 2858abd

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/publish-lux-docker-image.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,27 @@ jobs:
6969
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
7070
runs-on: ubuntu-latest
7171
steps:
72+
- name: Fetch deploy credentials from KMS
73+
id: kms
74+
env:
75+
HANZO_API_KEY: ${{ secrets.HANZO_API_KEY }}
76+
KMS_ENDPOINT: ${{ vars.KMS_ENDPOINT || 'https://kms.hanzo.ai' }}
77+
run: |
78+
response=$(curl -sf "${KMS_ENDPOINT}/api/v1/secrets/raw?secretPath=/deploy&environment=production" \
79+
-H "Authorization: Bearer ${HANZO_API_KEY}" 2>/dev/null || echo "")
80+
if [ -n "$response" ]; then
81+
token=$(echo "$response" | jq -r '.secrets[] | select(.secretKey=="DO_API_TOKEN") | .secretValue // empty')
82+
fi
83+
if [ -z "${token:-}" ]; then
84+
echo "::error::Deploy credentials not found. Set HANZO_API_KEY with KMS access."
85+
exit 1
86+
fi
87+
echo "::add-mask::${token}"
88+
echo "token=${token}" >> "$GITHUB_OUTPUT"
89+
7290
- name: Deploy to lux-k8s
7391
env:
74-
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
92+
DO_TOKEN: ${{ steps.kms.outputs.token }}
7593
run: |
7694
INSTALL_DIR="$HOME/.local/bin"
7795
mkdir -p "$INSTALL_DIR"
@@ -84,7 +102,7 @@ jobs:
84102
curl -sLO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
85103
chmod +x kubectl && mv kubectl "$INSTALL_DIR/kubectl"
86104
fi
87-
doctl auth init -t "$DIGITALOCEAN_ACCESS_TOKEN"
105+
doctl auth init -t "$DO_TOKEN"
88106
doctl kubernetes cluster kubeconfig save lux-k8s
89107
# Mainnet explorers
90108
for dep in explorer-mainnet explorer-zoo explorer-hanzo explorer-spc explorer-pars; do

0 commit comments

Comments
 (0)