Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit f52b8ca

Browse files
committed
add ci to trigger build of registry-v2 init commit
1 parent cbd06b1 commit f52b8ca

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/scripts/deploy-registry.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -o pipefail
3+
set -u
4+
5+
VERBOSE="${VERBOSE:-0}"
6+
if [[ "${VERBOSE}" -ne "0" ]]; then
7+
set -x
8+
fi
9+
10+
# List of required environment variables
11+
required_vars=(
12+
"GCLOUD_API_KEY"
13+
"GCLOUD_PROD_DEPLOY_SECRET"
14+
"GCLOUD_DEV_DEPLOY_SECRET"
15+
)
16+
17+
# Check if each required variable is set
18+
for var in "${required_vars[@]}"; do
19+
if [[ -z "${!var:-}" ]]; then
20+
echo "Error: Environment variable '$var' is not set."
21+
exit 1
22+
fi
23+
done
24+
25+
# Trigger a build for dev
26+
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}" \
27+
-H "Content-Type: application/json" \
28+
-d '{}'
29+
30+
# Trigger a build for prod
31+
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}" \
32+
-H "Content-Type: application/json" \
33+
-d '{}'

.github/workflows/check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- name: Run check.sh
1717
run: |
18-
./.github/scripts/check.sh
18+
./.github/scripts/deploy-registry.sh
1919
env:
2020
INSTATUS_API_KEY: ${{ secrets.INSTATUS_API_KEY }}
2121
INSTATUS_PAGE_ID: ${{ secrets.INSTATUS_PAGE_ID }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: deploy-registry
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Run check.sh
19+
run: |
20+
./.github/scripts/check.sh
21+
env:
22+
GCLOUD_API_KEY: ${{ secrets.GCLOUD_API_KEY }}
23+
GCLOUD_PROD_DEPLOY_SECRET: ${{ secrets.GCLOUD_PROD_DEPLOY_SECRET }}
24+
GCLOUD_DEV_DEPLOY_SECRET: ${{ secrets.GCLOUD_DEV_DEPLOY_SECRET }}
25+

0 commit comments

Comments
 (0)