@@ -7,9 +7,7 @@ run-name: Deploy Control Plane Staging App
7
7
on :
8
8
push :
9
9
branches :
10
- - ' main'
11
- - ' master'
12
- - ${{ github.vars.STAGING_APP_BRANCH }}
10
+ - ' *'
13
11
workflow_dispatch :
14
12
15
13
# Convert the GitHub secret variables to environment variables for use by the Control Plane CLI
@@ -31,23 +29,29 @@ jobs:
31
29
32
30
validate-branch :
33
31
runs-on : ubuntu-latest
32
+ outputs :
33
+ is_deployable : ${{ steps.check_branch.outputs.is_deployable }}
34
34
steps :
35
35
- name : Check if allowed branch
36
+ id : check_branch
36
37
run : |
37
38
if [[ -n "${STAGING_APP_BRANCH}" ]]; then
38
- if [[ "${GITHUB_REF#refs/heads/}" != "${STAGING_APP_BRANCH}" ]]; then
39
- echo "This workflow only runs on configured branch: ${STAGING_APP_BRANCH}"
40
- echo "Current branch: ${GITHUB_REF#refs/heads/}"
41
- exit 1
39
+ if [[ "${GITHUB_REF#refs/heads/}" == "${STAGING_APP_BRANCH}" ]]; then
40
+ echo "is_deployable=true" >> $GITHUB_OUTPUT
41
+ else
42
+ echo "Branch '${GITHUB_REF#refs/heads/}' is not the configured deployment branch '${STAGING_APP_BRANCH}'"
43
+ echo "is_deployable=false" >> $GITHUB_OUTPUT
42
44
fi
43
- elif [[ "${GITHUB_REF}" != "refs/heads/main" && "${GITHUB_REF}" != "refs/heads/master" ]]; then
44
- echo "This workflow only runs on main or master branch (no STAGING_APP_BRANCH configured)"
45
- echo "Current branch: ${GITHUB_REF#refs/heads/}"
46
- exit 1
45
+ elif [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == "refs/heads/master" ]]; then
46
+ echo "is_deployable=true" >> $GITHUB_OUTPUT
47
+ else
48
+ echo "Branch '${GITHUB_REF#refs/heads/}' is not main/master (no STAGING_APP_BRANCH configured)"
49
+ echo "is_deployable=false" >> $GITHUB_OUTPUT
47
50
fi
48
51
49
52
build :
50
53
needs : validate-branch
54
+ if : needs.validate-branch.outputs.is_deployable == 'true'
51
55
runs-on : ubuntu-latest
52
56
outputs :
53
57
image_tag : ${{ steps.build.outputs.image_tag }}
0 commit comments