Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# GitHub Actions workflow.
#
# Automatically deploys the Node.js microservice to Kubernetes on push to any branch.
# For real use you might want to restrict this to the "prod" branch.
#

name: Delete microservice

on:
#
# Allows deployment to be invoked manually through the GitHub Actions user interface.
#
workflow_dispatch:

jobs:

deploy:
runs-on: ubuntu-latest

env:
VERSION: ${{ github.sha }}
CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }}
REGISTRY_UN: ${{ secrets.REGISTRY_UN }}
REGISTRY_PW: ${{ secrets.REGISTRY_PW }}

steps:

# Checks-out your repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v3

- uses: tale/kubectl-action@v1
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
kubectl-version: v1.24.2

- name: Delete
run: ./scripts/delete.sh
46 changes: 46 additions & 0 deletions .github/workflows/destroy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# GitHub Actions workflow.
#
# Automatically deploys the Node.js microservice to Kubernetes on push to any branch.
# For real use you might want to restrict this to the "prod" branch.
#

name: Destroy microservice

on:
#
# Allows deployment to be invoked manually through the GitHub Actions user interface.
#
workflow_dispatch:

jobs:

deploy:
runs-on: ubuntu-latest

env:
VERSION: ${{ github.sha }}
CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }}
REGISTRY_UN: ${{ secrets.REGISTRY_UN }}
REGISTRY_PW: ${{ secrets.REGISTRY_PW }}

steps:

# Checks-out your repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v3

#
# Installs Kubectl and connects it to the cluster.
#
# https://github.com/marketplace/actions/kubernetes-cli-kubectl
#
- uses: tale/kubectl-action@v1
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
kubectl-version: v1.24.2

#
# Expands the configuration template and deploys the microservice.
#
- name: Destroy
run: ./scripts/delete.sh
5 changes: 3 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
# ./scripts/deploy.sh
#

set -u # or set -o nounset
#set -u
set -o nounset
: "$CONTAINER_REGISTRY"
: "$VERSION"

envsubst < ./scripts/kubernetes/deploy.yaml | kubectl apply -f -
envsubst < ./scripts/kubernetes/deploy.yaml | kubectl apply -f -