Skip to content

Deploy Sakura to Stage #307

Deploy Sakura to Stage

Deploy Sakura to Stage #307

Workflow file for this run

name: Deploy Sakura to Stage
on: [workflow_dispatch]
jobs:
deploy-sakura:
runs-on: ubuntu-latest
steps:
- name: Checkout build tools
uses: actions/checkout@v2
with:
repository: lolibrary/build
token: ${{ secrets.PAT }}
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GCLOUD_SA_KEY }}
- name: GCloud setup
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v1'
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- name: GHCR login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
registry: ghcr.io
- name: Deploy
run: |
docker pull $DOCKER_WIKI_REPO:latest
export WIKI_TAG=$(docker image inspect -f "{{(index .RepoDigests 0)}}" $DOCKER_WIKI_REPO:latest)
cat "$(pwd)/manifests/stage.yml" | sed "s#PLACEHOLDER#\"$DOCKER_SHA_TAG\"#" | sed "s#WIKIHOLDER#\"$WIKI_TAG\"#" | kubectl apply --record -f -
kubectl rollout status "deployment/s-sakura" -n $NAMESPACE
env:
DOCKER_SHA_TAG: "ghcr.io/lolibrary/sakura:${{ github.sha }}"
DOCKER_WIKI_REPO: "ghcr.io/lolibrary/wiki"
PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
NAMESPACE: "default"
GKE_CLUSTER: "staging"
GKE_ZONE: "us-central1-a"