Skip to content

Merge pull request #383 from samternent/changeset-release/main #1

Merge pull request #383 from samternent/changeset-release/main

Merge pull request #383 from samternent/changeset-release/main #1

name: Production Tag Deployment
env:
PNPM_CACHE_PATH: ~/.pnpm-store
PNPM_CACHE_NAME: pnpm-store-cache
on:
push:
tags:
- "ternent-api-[0-9]+.[0-9]+.[0-9]+"
jobs:
Deploy-Production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@master
with:
fetch-depth: 0
persist-credentials: false
- name: Get node version
id: nvmrc
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker image
run: pnpm build:ternent-api
- name: Push docker image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/ternent-api:latest
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig Production
run: doctl kubernetes cluster kubeconfig save ${{ secrets.DIGITALOCEAN_K8S_CLUSTER_ID }}
- name: Kubernetes rollout the latest image
run: kubectl -n backend rollout restart deployment ternent-api