Skip to content

Backend: Build & Deploy #18

Backend: Build & Deploy

Backend: Build & Deploy #18

Workflow file for this run

name: Build & Deploy Backend
on: workflow_dispatch
env:
PROJECT_NAME: subabot
jobs:
build_and_push:
name: Build & Push Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build, tag and push Docker image
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ github.repository_owner }}/${{ env.PROJECT_NAME }}:${{ github.sha }}
platforms: linux/arm64,linux/amd64
deploy_to_production:
name: Deploy to production
needs: build_and_push
runs-on: ubuntu-latest
environment: production
concurrency:
group: production
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Helm Configure & Deploy
uses: dorukgezici/helm-deploy-action@v1
with:
kubeconfig-base64: ${{ secrets.KUBE_CONFIG }}
installation-name: ${{ env.PROJECT_NAME }}
chart-path: backend/k8s-helm
extra-args: "--set image.tag=${{ github.sha }}"
token: ${{ github.token }}