add ci to trigger build of registry-v2 init commit

pull/363/head
Benjamin 7 months ago
parent cbd06b1135
commit f52b8ca6e1

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -o pipefail
set -u
VERBOSE="${VERBOSE:-0}"
if [[ "${VERBOSE}" -ne "0" ]]; then
set -x
fi
# List of required environment variables
required_vars=(
"GCLOUD_API_KEY"
"GCLOUD_PROD_DEPLOY_SECRET"
"GCLOUD_DEV_DEPLOY_SECRET"
)
# Check if each required variable is set
for var in "${required_vars[@]}"; do
if [[ -z "${!var:-}" ]]; then
echo "Error: Environment variable '$var' is not set."
exit 1
fi
done
# Trigger a build for dev
curl -X POST "https://cloudbuild.googleapis.com/v1/projects/coder-registry-1/triggers/http-build-registry-v2-dev:webhook?key=${GCLOUD_API_KEY}&secret=${GCLOUD_DEV_DEPLOY_SECRET}" \
-H "Content-Type: application/json" \
-d '{}'
# Trigger a build for prod
curl -X POST "https://cloudbuild.googleapis.com/v1/projects/coder-registry-1/triggers/http-build-registry-v2-trigger:webhook?key=${GCLOUD_API_KEY}&secret=${GCLOUD_PROD_DEPLOY_SECRET}" \
-H "Content-Type: application/json" \
-d '{}'

@ -15,7 +15,7 @@ jobs:
- name: Run check.sh
run: |
./.github/scripts/check.sh
./.github/scripts/deploy-registry.sh
env:
INSTATUS_API_KEY: ${{ secrets.INSTATUS_API_KEY }}
INSTATUS_PAGE_ID: ${{ secrets.INSTATUS_PAGE_ID }}

@ -0,0 +1,25 @@
name: deploy-registry
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run check.sh
run: |
./.github/scripts/check.sh
env:
GCLOUD_API_KEY: ${{ secrets.GCLOUD_API_KEY }}
GCLOUD_PROD_DEPLOY_SECRET: ${{ secrets.GCLOUD_PROD_DEPLOY_SECRET }}
GCLOUD_DEV_DEPLOY_SECRET: ${{ secrets.GCLOUD_DEV_DEPLOY_SECRET }}
Loading…
Cancel
Save