8000 feat: ci to build new registry on push to main by bcpeinhardt · Pull Request #363 · coder/modules · GitHub
[go: up one dir, main page]

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

feat: ci to build new registry on push to main #363

Merged
merged 21 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add ci to trigger build of registry-v2 init commit
  • Loading branch information
bcpeinhardt committed Dec 11, 2024
commit f52b8ca6e1893c71bb6a50b99a34430c8f154b18
33 changes: 33 additions & 0 deletions .github/scripts/deploy-registry.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/deploy-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: deploy-registry

on:
push:
branches:
- main

pull_request:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to deploy on each PR too?

Copy link
Collaborator Author
@bcpeinhardt bcpeinhardt Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I should pull that out, was moving too quickly, good catch 🙏

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 }}

0