-
Notifications
You must be signed in to change notification settings - Fork 8
50 lines (46 loc) · 2.2 KB
/
build-and-deploy-to-gcr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
on:
push:
workflow_dispatch:
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
GAR_LOCATION: europe-west1
GKE_CLUSTER: main
GKE_ZONE: europe-west1-b
DEPLOYMENT_NAME: unistudents-api
REPOSITORY: unistudents-api
IMAGE: unistudents-api
jobs:
setup-build-publish:
name: Build & publish image to GCR
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Student-service Jar archive
uses: robinraju/release-downloader@v1.7
with:
repository: "UniStudents/student-service"
latest: true
fileName: "student-service-full.jar"
token: ${{ secrets.GH_TOK }}
- name: Download eLearning-service Jar archive
uses: robinraju/release-downloader@v1.7
with:
repository: "UniStudents/elearning-service"
latest: true
fileName: "elearning-service-full.jar"
token: ${{ secrets.GH_TOK }}
- run: find ./libs -name "student-*.jar" -exec cp student-service-full.jar {} \;
- run: find ./libs -name "elearning-*.jar" -exec cp elearning-service-full.jar {} \;
- id: auth
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GOOGLE_KEY }}
- name: Upload source code and build the image
run: gcloud builds submit --suppress-logs --pack image=europe-west1-docker.pkg.dev/unistudents-faa49/unistudents-api/unistudents-api
- name: Tag the latest commit
run: gcloud artifacts docker tags add $(gcloud artifacts docker images list europe-west1-docker.pkg.dev/unistudents-faa49/unistudents-api/unistudents-api --filter="package=europe-west1-docker.pkg.dev/unistudents-faa49/unistudents-api/unistudents-api" --sort-by="~UPDATE_TIME" --limit=1 --format="value(format("{0}@{1}",package,version))") $(gcloud artifacts docker images list europe-west1-docker.pkg.dev/unistudents-faa49/unistudents-api/unistudents-api/ --filter="package=europe-west1-docker.pkg.dev/unistudents-faa49/unistudents-api/unistudents-api" --sort-by="~UPDATE_TIME" --limit=1 --format="value(format("{0}",package))"):$GITHUB_SHA