Skip to content

Deploy to Test Env

Deploy to Test Env #54

name: Deploy to Test Env
on:
workflow_dispatch:
inputs:
git-tag:
description: 'Branch/hash/tag'
required: true
default: 'master'
env:
project-directory: ./
jobs:
deploy-test:
name: Deploy latest to test environment, requires approval
runs-on: ubuntu-latest
if: |
github.repository == 'Greenstand/treetracker-wallet-api'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-tag }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
with:
path: ./
- name: Install kustomize
run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- name: Run kustomize
run: (cd deployment/overlays/test && ../../../kustomize edit set image greenstand/treetracker-wallet-api:${{ steps.package-version.outputs.current-version }} )
- name: Install doctl for kubernetes
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.TEST_DIGITALOCEAN_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save ${{ secrets.TEST_CLUSTER_NAME }}
- name: Delete completed migration jobs prior to deployment
run: kubectl -n wallet-api delete job wallet-db-migration-job
- name: Update kubernetes resources
run: kustomize build deployment/overlays/test | kubectl apply -n ${{ secrets.K8S_NAMESPACE }} --wait -f -