Update deploy-to-cb.yml #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
repository: "UniStudents/student-service" | |
latest: true | |
fileName: "student-service-full.jar" | |
token: ${{ secrets.GH_TOK }} | |
- name: Download eLearning-service Jar archive | |
uses: robinraju/[email protected] | |
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 |