Skip to content

Commit ca33f8d

Browse files
authored
Added a job to send an email with the deployment url (#16)
1 parent 0a26ac1 commit ca33f8d

File tree

8 files changed

+44
-21
lines changed

8 files changed

+44
-21
lines changed

.github/workflows/create-image.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
githubRepo:
77
description: "Link of public github repo to deploy"
88
required: true
9+
email:
10+
description: "Email address to send email to"
11+
required: true
912

1013
jobs:
1114
create_student_submodule:
@@ -88,3 +91,4 @@ jobs:
8891
repo_name: ${{ needs.dockerise-image.outputs.repo_name }}
8992
year: ${{ needs.dockerise-image.outputs.year }}
9093
image: ${{ needs.dockerise-image.outputs.image_name }}
94+
email: ${{ github.event.inputs.email }}

.github/workflows/deploy-image.yml

+36-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
description: "image name"
2020
required: true
2121
type: string
22+
email:
23+
description: "Email address to send email to"
24+
required: true
25+
type: string
2226

2327
jobs:
2428
create-or-update-values-file:
@@ -92,16 +96,16 @@ jobs:
9296
steps:
9397
- name: Checkout
9498
uses: actions/checkout@v4
95-
- id: 'auth'
96-
name: 'Authenticate to Google Cloud'
97-
uses: 'google-github-actions/auth@v2'
99+
- id: "auth"
100+
name: "Authenticate to Google Cloud"
101+
uses: "google-github-actions/auth@v2"
98102
with:
99103
create_credentials_file: true
100-
workload_identity_provider: 'projects/1006240973223/locations/global/workloadIdentityPools/gha-create-gke-cluster/providers/github-actions'
101-
service_account: '[email protected]'
102-
- id: 'get-credentials'
104+
workload_identity_provider: "projects/1006240973223/locations/global/workloadIdentityPools/gha-create-gke-cluster/providers/github-actions"
105+
service_account: "[email protected]"
106+
- id: "get-credentials"
103107
name: Get GKE creds
104-
uses: 'google-github-actions/get-gke-credentials@v2'
108+
uses: "google-github-actions/get-gke-credentials@v2"
105109
with:
106110
cluster_name: code-idp-gke
107111
location: europe-west1
@@ -120,3 +124,28 @@ jobs:
120124
git pull
121125
helm upgrade -i ${FOLDER_NAME} ./codeIdpChart -f submissions-${YEAR}/${FOLDER_NAME}/values.yml -n submissions-${YEAR}
122126
echo "STUDENT_URL=$(kubectl get ingress ${FOLDER_NAME}-ingress -n submissions-2024 -o jsonpath='{.spec.rules[*].host}')" >> $GITHUB_ENV
127+
128+
send_email_with_url:
129+
needs: deploy-with-helm
130+
permissions:
131+
id-token: write
132+
contents: read
133+
name: "send an email address with the url"
134+
runs-on: ubuntu-latest
135+
defaults:
136+
run:
137+
shell: bash
138+
if: ${{ needs.deploy-with-helm.outputs.students_url }}
139+
steps:
140+
- name: Send mail
141+
uses: dawidd6/action-send-mail@v3
142+
with:
143+
server_address: mail.your-server.de
144+
server_port: 465
145+
secure: true
146+
147+
password: ${{secrets.MAIL_PASSWORD}}
148+
subject: Application deployed successfully! ✨
149+
to: ${{ inputs.email }}
150+
from: The friendly code idp bot
151+
body: "Your application has been deployed! 🎉 you can find your application deployed on the following url: ${{ needs.deploy-with-helm.outputs.students_url }}"

.github/workflows/update-image.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
githubRepo:
77
description: "Link of public github repo to deploy"
88
required: true
9+
email:
10+
description: "Email address to send email to"
11+
required: true
912

1013
jobs:
1114
check_if_update_needed:
@@ -97,3 +100,4 @@ jobs:
97100
repo_name: ${{ needs.dockerise-image.outputs.repo_name }}
98101
year: ${{ needs.dockerise-image.outputs.year }}
99102
image: ${{ needs.dockerise-image.outputs.image_name }}
103+
email: ${{ github.event.inputs.email }}

.gitmodules

-6
This file was deleted.
This file was deleted.

submissions-2024/maggieekubat-recipe/values.yml

-3
This file was deleted.

submissions-2024/noemiamccarthy-web-basics-hand-in-04/values.yml

-3
This file was deleted.

0 commit comments

Comments
 (0)