Add continuous deployment action for GKE. #5
Workflow file for this run
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
# Copyright 2023 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Deploy to GKE | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository. | |
uses: actions/checkout@v3 | |
- id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Install GKE cloud plugin | |
run: gcloud components install gke-gcloud-auth-plugin | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.20' | |
cache: true | |
- name: Srdjan | |
run: | |
gcloud auth list; gcloud container clusters list; | |
- name: Retrieve weaver version | |
run: | | |
echo "WEAVER_VERSION=$(go list -m -f '{{.Version}}' github.com/ServiceWeaver/weaver | sed -E 's/(.*)\..*/\1/')" >> $GITHUB_ENV | |
- name: Install weaver-gke | |
run: go install github.com/ServiceWeaver/weaver-gke/cmd/weaver-gke@${{ env.WEAVER_VERSION }} | |
- name: Build the app | |
run: go build . | |
- name: Deploy the app | |
run: weaver-gke deploy --detach weaver.toml |