mirror of
https://github.com/pragma-/pbot.git
synced 2025-07-06 21:47:24 +02:00
83 lines
2.2 KiB
YAML
83 lines
2.2 KiB
YAML
name: Deploy candide for Libera
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
|
|
GKE_CLUSTER: pragma
|
|
GKE_ZONE: us-central1-c
|
|
DEPLOYMENT_NAME: candide
|
|
NAMESPACE: candide
|
|
REPOSITORY: pbot
|
|
IMAGE: pbot
|
|
|
|
jobs:
|
|
build-deploy-gke-prod:
|
|
name: Build & Deploy to GKE in Production
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: 'Authenticate to Google Cloud'
|
|
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: Setup kubectl
|
|
# id: install-kubectl
|
|
# uses: azure/setup-kubectl@v3
|
|
|
|
- name: Set up GKE credentials
|
|
uses: google-github-actions/get-gke-credentials@v2
|
|
with:
|
|
cluster_name: ${{ env.GKE_CLUSTER }}
|
|
location: ${{ env.GKE_ZONE }}
|
|
|
|
- name: Testing
|
|
run: |
|
|
kubectl get pods
|
|
|
|
- name: Authenticate Docker
|
|
run: |
|
|
gcloud auth configure-docker
|
|
|
|
- name: Build image
|
|
run: |-
|
|
docker build --tag "gcr.io/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" .
|
|
|
|
- name: Push image
|
|
run: |-
|
|
docker push "gcr.io/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA"
|
|
|
|
# - name: Set up Kustomize
|
|
# run: |-
|
|
# curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
|
|
# chmod u+x ./kustomize
|
|
#
|
|
# - name: Deploy image
|
|
# run: |-
|
|
# # replacing the image name in the k8s template
|
|
# ./kustomize edit set image LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE:TAG=gcr.io/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA
|
|
# ./kustomize build . | kubectl apply -f -
|
|
# kubectl rollout status deployment/$DEPLOYMENT_NAME
|
|
# kubectl get services -o wide
|
|
|
|
- name: Deploy image
|
|
run: |-
|
|
sed -i -e 's/IMAGE_PLACEHOLDER/'$PROJECT_ID/$REPOSITORY/$IMAGE:${{ github.sha }}'/' k8s/deployment.yaml
|
|
kubectl apply -f k8s/deployment.yaml |