Skip to content

Commit

Permalink
Add K8s deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
camuffo committed Oct 14, 2024
1 parent 4077b3d commit a9ee5e1
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/k8s-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy to Kubernetes

on:
push:
branches: ["development", "k8s-deploy"]
pull_request:
branches: ["development"]

jobs:
deploy:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NAMESPACE: "gn-demo-dev"
KUBECONFIG: "${{ github.workspace }}/.kube/config"

runs-on: ubuntu-24.04

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Build and push Docker image
# id: push
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}

#- name: "Docker image build"
# run: |
# # create dummy .env file just for the build
# python3 ./create-envfile.py --no-input --hostname development.demo.geonode.org

# docker compose build django --no-cache

#- name: "Docker image push"
# run: |
# docker tag geonode_demo/geonode:master geosolutionsit/geonode-demo:development
# docker push geosolutionsit/geonode-demo:development

- name: "Write to $KUBECONFIG"
run: |
mkdir -p '${{ github.workspace }}/.kube' \
&& umask 177 \
&& echo '${{ secrets.K8S_CONFIG }}' > "$KUBECONFIG"
- run: "kubectl version"

- name: Deploy to Kubernetes
run: |
helm -n ${{ env.NAMESPACE }} list \
kubectl -n ${{ env.NAMESPACE }} get pod \
echo TODO

0 comments on commit a9ee5e1

Please sign in to comment.