Skip to content

Commit 3617f4a

Browse files
committed
add tag based deploy
1 parent c1e6950 commit 3617f4a

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- dev
77
- main
8+
tags:
9+
- 'v*'
810
workflow_dispatch:
911

1012
concurrency:
@@ -113,13 +115,18 @@ jobs:
113115

114116
- name: Set environment variables
115117
run: |
116-
SANITIZED_REF=$(echo "${GITHUB_REF##*/}" | tr '/' '-')
117-
echo "SANITIZED_REF=$SANITIZED_REF" >> $GITHUB_ENV
118-
echo "INGRESS=$([ "$SANITIZED_REF" == "main" ] && echo "docs.torus.network" || echo "$SANITIZED_REF.docs.torus.network")" >> $GITHUB_ENV
118+
echo "SANITIZED_REF=$(echo "${GITHUB_REF##*/}" | tr '/' '-')" >> $GITHUB_ENV
119+
120+
- name: Deploy application (Branch)
121+
if: github.ref_type == 'branch'
122+
run: |
123+
helmfile sync -e ${{ github.ref_name == 'main' && 'prod' || 'dev' }} \
124+
--set deployment.image.tag=${{ steps.commit.outputs.short }}
119125
120-
- name: Deploy application
126+
- name: Deploy application (Tag)
127+
if: github.ref_type == 'tag'
121128
run: |
122129
helmfile sync \
123-
--state-values-set releaseName=${{ env.SANITIZED_REF }}-torus-docs \
124-
--state-values-set ingressHost=${{ env.INGRESS }} \
125-
--set deployment.image.tag=${{ steps.commit.outputs.short }}
130+
--state-values-set releaseName="${{ env.SANITIZED_REF }}-torus-docs" \
131+
--state-values-set ingressHost="${{ env.SANITIZED_REF }}.docs.torus.network" \
132+
--set deployment.image.tag=${{ steps.commit.outputs.short }}

helmfile.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ environments:
22
default:
33
values:
44
- helm/values.yaml
5+
dev:
6+
values:
7+
- helm/values.yaml
8+
- releaseName: dev-torus-docs
9+
- ingressHost: dev.docs.torus.network
10+
prod:
11+
values:
12+
- helm/values.yaml
13+
- releaseName: torus-docs
14+
- ingressHost: docs.torus.network
515
---
616
helmDefaults:
717
wait: true

0 commit comments

Comments
 (0)