Skip to content

Commit 170efb9

Browse files
fix: update deployment conditions to support tag-based deployments in CI/CD workflows
1 parent dbbd25c commit 170efb9

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.github/workflows/cicd.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,22 @@ jobs:
100100
- name: Determine deployment environment
101101
id: set-environment
102102
run: |
103-
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
103+
if [[ "${{ github.ref }}" =~ refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ ]]; then
104104
echo "environment=Staging" >> $GITHUB_OUTPUT
105-
echo "🎯 Deployment target: Staging (develop branch)"
106-
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
105+
echo "🎯 Deployment target: Staging (pre-release tag: ${{ github.ref }})"
106+
elif [[ "${{ github.ref }}" =~ refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
107107
echo "environment=Production" >> $GITHUB_OUTPUT
108-
echo "🎯 Deployment target: Production (main branch)"
108+
echo "🎯 Deployment target: Production (release tag: ${{ github.ref }})"
109109
else
110110
echo "environment=none" >> $GITHUB_OUTPUT
111-
echo "🚫 No deployment target (branch/tag not configured for deployment)"
111+
echo "🚫 No deployment target (tag not configured for deployment: ${{ github.ref }})"
112112
exit 0
113113
fi
114114
115-
# Automatic deployment based on branch
115+
# Automatic deployment based on tags
116116
deploy-app:
117117
needs: [all-ci-passed]
118-
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' }}
118+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
119119
uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main
120120
with:
121121
environment: ${{ needs.all-ci-passed.outputs.environment }}

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ name: Release
33
on:
44
push:
55
branches: [develop, main]
6-
tags-ignore:
7-
- '**'
86

97
jobs:
108
release:
9+
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
1110
runs-on: ubuntu-latest
1211
permissions:
1312
contents: write
14-
1513
steps:
1614
- uses: actions/checkout@v4
1715
with:
@@ -28,3 +26,7 @@ jobs:
2826
conventional-changelog-conventionalcommits
2927
env:
3028
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
29+
GIT_AUTHOR_NAME: "Felix T.J. Dietrich"
30+
GIT_AUTHOR_EMAIL: "[email protected]"
31+
GIT_COMMITTER_NAME: "Felix T.J. Dietrich"
32+
GIT_COMMITTER_EMAIL: "[email protected]"

0 commit comments

Comments
 (0)