Skip to content

build+push+deploy wasm app to k8s cluster #1

build+push+deploy wasm app to k8s cluster

build+push+deploy wasm app to k8s cluster #1

name: build+push+deploy wasm app to k8s cluster
on:
workflow_dispatch:
jobs:
build-push-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Build Docker image
run: docker build -t stepanklos/wasm:$(echo $GITHUB_SHA | head -c7) .
- name: Dockerhub login
run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
- name: Push image to Dockerhub
run: docker push stepanklos/wasm:$(echo $GITHUB_SHA | head -c7)
- name: Update deployment file
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|stepanklos/wasm:'${TAG}'|' $GITHUB_WORKSPACE/config/deployment.yaml
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.CLUSTER_NAME }}
- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -f $GITHUB_WORKSPACE/config/deployment.yaml
- name: Verify Deployment
run: kubectl rollout status deployment/lnmap