Skip to content

Commit

Permalink
github actions & environment files
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-codetogether committed Nov 21, 2024
1 parent 4381a28 commit e5a8a59
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/portal-dev-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to Production

on:
workflow_dispatch:
inputs:
tag:
type: string
description: The tag to deploy
required: true

env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
DOCKER_REGISTRY: your-registry
DOCKER_IMAGE: your-app

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up kubectl
uses: azure/k8s-set-context@v1
with:
kubeconfig: ${{ secrets.DEV_KUBE_CONFIG }}

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'v3.12.0'

- name: Update image tag in values file
run: |
sed -i "s/tag: .*/tag: ${{ github.event.inputs.tag }}/" charts/portal/environments/dev.yaml
- name: Commit changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add charts/portal/environments/dev.yaml
git commit -m "Update image tag to ${{ github.event.inputs.tag }}"
git push
- name: Deploy to dev
run: |
helm upgrade portal portal -n portal -f portal/values.yaml -f portal/environments/dev.yaml
46 changes: 46 additions & 0 deletions .github/workflows/portal-production-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to Production

on:
workflow_dispatch:
inputs:
tag:
type: string
description: The tag to deploy
required: true

env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
DOCKER_REGISTRY: your-registry
DOCKER_IMAGE: your-app

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up kubectl
uses: azure/k8s-set-context@v1
with:
kubeconfig: ${{ secrets.PRODUCTION_KUBE_CONFIG }}

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'v3.12.0'

- name: Update image tag in values file
run: |
sed -i "s/tag: .*/tag: ${{ github.event.inputs.tag }}/" charts/portal/environments/production.yaml
- name: Commit changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add charts/portal/environments/production.yaml
git commit -m "Update image tag to ${{ github.event.inputs.tag }}"
git push
- name: Deploy to production
run: |
helm upgrade portal portal -n portal -f portal/values.yaml -f portal/environments/production.yaml
2 changes: 1 addition & 1 deletion charts/portal/environments/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1

ingress:
hosts:
- host: staging.app.example.com
- host: portal.dev.codetogether.com
paths:
- path: /
pathType: Prefix
Expand Down
6 changes: 4 additions & 2 deletions charts/portal/environments/production.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
environment: production
replicaCount: 3
replicaCount: 2
image:
tag: c819a2996f8d96cfcadc73cba625d01d70f8df2b

ingress:
hosts:
- host: app.example.com
- host: app.codetogether.com
paths:
- path: /
pathType: Prefix
Expand Down

0 comments on commit e5a8a59

Please sign in to comment.