Skip to content

Commit 2aa2ad9

Browse files
authored
Merge pull request #12 from daimor/patch-1
centralized deploy workflow
2 parents 89658f2 + ccb0f68 commit 2aa2ad9

1 file changed

Lines changed: 10 additions & 93 deletions

File tree

.github/workflows/build-push-gcr.yaml

Lines changed: 10 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5,98 +5,15 @@ on:
55
branches:
66
- master
77
- main
8-
9-
env:
10-
# Change this section according to your needs
11-
IMAGE_NAME: online
12-
SERVICE: online
13-
DOMAIN_NAME: online.demo.community.intersystems.com
14-
15-
# Leave this section untouched
16-
PROJECT_ID: iris-community-demos
17-
CLUSTER_NAME: demo
18-
GITHUB_SHA: ${{ github.sha }}
19-
GCR_LOCATION: eu.gcr.io
20-
REGION: europe-west2
21-
NAMESPACE: demo
8+
workflow_dispatch:
229

2310
jobs:
24-
deploy-cloud-run:
25-
name: Deploy to Cloud Run
26-
runs-on: ubuntu-20.04
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v3
30-
31-
- name: Google Authentication
32-
uses: google-github-actions/auth@v1.0.0
33-
with:
34-
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}
35-
36-
- name: Get GKE credentials
37-
uses: google-github-actions/get-gke-credentials@v1.0.1
38-
with:
39-
project_id: iris-community-demos
40-
cluster_name: demo
41-
location: europe-west2
42-
43-
- name: Setup gcloud cli
44-
uses: google-github-actions/setup-gcloud@v1.0.0
45-
with:
46-
version: '412.0.0'
47-
48-
- name: Authorize Docker push
49-
run: gcloud --quiet auth configure-docker
50-
51-
- name: Build and Push image
52-
run: |
53-
docker buildx build -t ${GCR_LOCATION}/${PROJECT_ID}/${IMAGE_NAME}:${GITHUB_SHA} .
54-
docker push ${GCR_LOCATION}/${PROJECT_ID}/${IMAGE_NAME}:${GITHUB_SHA}
55-
56-
- name: Deploy to Cloud Run
57-
run: |
58-
echo "[INFO] Set google project..."
59-
gcloud config set project ${PROJECT_ID}
60-
61-
echo "[INFO] Deploy service..."
62-
gcloud run deploy ${SERVICE} \
63-
--platform gke \
64-
--cluster ${CLUSTER_NAME} \
65-
--cluster-location ${REGION} \
66-
--namespace ${NAMESPACE} \
67-
--port 52773 \
68-
--min-instances 1 \
69-
--memory 512Mi \
70-
--timeout 300 \
71-
--verbosity debug \
72-
--image ${GCR_LOCATION}/${PROJECT_ID}/${IMAGE_NAME}:${GITHUB_SHA}
73-
74-
echo "[INFO] Create domain mappings..."
75-
if [[ $(gcloud run domain-mappings list --platform gke --cluster ${CLUSTER_NAME} --cluster-location ${REGION} --namespace ${NAMESPACE} --filter "DOMAIN=${DOMAIN_NAME}" | grep -v DOMAIN | wc -l) == 0 ]]; then
76-
gcloud run domain-mappings create \
77-
--service ${SERVICE} \
78-
--platform gke \
79-
--cluster ${CLUSTER_NAME} \
80-
--cluster-location ${REGION} \
81-
--namespace ${NAMESPACE} \
82-
--verbosity debug \
83-
--domain ${DOMAIN_NAME}
84-
fi
85-
86-
- name: Create domain name
87-
run: |
88-
kubectl version
89-
echo "[INFO] Checking if [${DOMAIN_NAME}] is in the existing Ingress annotation..."
90-
CURRENT_DOMAINS_LIST=$(kubectl -n gke-system get svc istio-ingress -o jsonpath="{.metadata.annotations['external-dns\.alpha\.kubernetes\.io/hostname']}")
91-
if [[ $(echo ${CURRENT_DOMAINS_LIST} | grep -w "${DOMAIN_NAME}" | wc -c) -eq 0 ]]; then \
92-
echo "[INFO] Domain [${DOMAIN_NAME}] is ABSENT in the domains list. Adding..."; \
93-
kubectl -n gke-system annotate --overwrite svc istio-ingress external-dns\.alpha\.kubernetes\.io/hostname=${CURRENT_DOMAINS_LIST},${DOMAIN_NAME}; \
94-
echo -n "[INFO] Resulting domain names: "
95-
kubectl -n gke-system get svc istio-ingress -o jsonpath="{.metadata.annotations['external-dns\.alpha\.kubernetes\.io/hostname']}"
96-
else
97-
echo "[INFO] Domain [${DOMAIN_NAME}] is in the domains list. Leave untouched..."; \
98-
fi
99-
100-
- name: Enable TLS-access
101-
run: |
102-
kubectl patch configmap config-domainmapping -n knative-serving -p '{"data":{"autoTLS":"Enabled"}}'
11+
deploy:
12+
uses: intersystems-community/demo-deployment/.github/workflows/deployment.yml@master
13+
with:
14+
# Replace the name: parameter below to have your application deployed at
15+
# https://project-name.demo.community.intersystems.com/
16+
name: project-name
17+
secrets:
18+
# Do not forget to add Secret in GitHub Repoository Settings with name SERVICE_ACCOUNT_KEY
19+
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}

0 commit comments

Comments
 (0)