add ci to trigger build of registry-v2 init commit
This commit is contained in:
33
.github/scripts/deploy-registry.sh
vendored
Normal file
33
.github/scripts/deploy-registry.sh
vendored
Normal file
@@ -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 '{}'
|
||||||
2
.github/workflows/check.yaml
vendored
2
.github/workflows/check.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run check.sh
|
- name: Run check.sh
|
||||||
run: |
|
run: |
|
||||||
./.github/scripts/check.sh
|
./.github/scripts/deploy-registry.sh
|
||||||
env:
|
env:
|
||||||
INSTATUS_API_KEY: ${{ secrets.INSTATUS_API_KEY }}
|
INSTATUS_API_KEY: ${{ secrets.INSTATUS_API_KEY }}
|
||||||
INSTATUS_PAGE_ID: ${{ secrets.INSTATUS_PAGE_ID }}
|
INSTATUS_PAGE_ID: ${{ secrets.INSTATUS_PAGE_ID }}
|
||||||
|
|||||||
25
.github/workflows/deploy-registry.yaml
vendored
Normal file
25
.github/workflows/deploy-registry.yaml
vendored
Normal file
@@ -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 }}
|
||||||
|
|
||||||
Reference in New Issue
Block a user