Skip to content

Commit ef88016

Browse files
committed
big-refactor-might-not-work
1 parent d256c0c commit ef88016

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

.github/actions/deploy-to-control-plane/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,6 @@ runs:
172172
body: buildingMessage
173173
});
174174
175-
- name: Build Docker Image
176-
uses: ./.github/actions/build-docker-image
177-
with:
178-
app_name: ${{ inputs.app_name }}
179-
org: ${{ inputs.org }}
180-
commit: ${{ env.COMMIT_HASH }}
181-
PR_NUMBER: ${{ env.PR_NUMBER }}
182-
183175
- name: Update Status - Deploying
184176
uses: actions/github-script@v7
185177
with:

.github/actions/deploy-to-control-plane/scripts/deploy.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ fi
2929
TEMP_OUTPUT=$(mktemp)
3030
trap 'rm -f "$TEMP_OUTPUT"' EXIT
3131

32+
# Build the Docker image
33+
echo "🏗️ Building Docker image"
34+
if ! cpflow build-image -a "$APP_NAME" --org "$CPLN_ORG" --verbose 2>&1 | tee "$TEMP_OUTPUT"; then
35+
echo "❌ Image build failed"
36+
echo "Full output:"
37+
cat "$TEMP_OUTPUT"
38+
exit 1
39+
fi
40+
3241
# Deploy the application
3342
echo "🚀 Deploying to Control Plane (timeout: ${WAIT_TIMEOUT}s)"
3443
if ! timeout "${WAIT_TIMEOUT}" cpflow deploy-image -a "$APP_NAME" --run-release-phase --org "$CPLN_ORG" --verbose 2>&1 | tee "$TEMP_OUTPUT"; then
@@ -42,7 +51,7 @@ fi
4251
RAILS_URL=$(grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\s|$)' "$TEMP_OUTPUT" | head -n1)
4352
if [ -z "$RAILS_URL" ]; then
4453
echo "❌ Failed to get app URL from deployment output"
45-
echo "Deployment output:"
54+
echo "Full output:"
4655
cat "$TEMP_OUTPUT"
4756
exit 1
4857
fi

.github/workflows/deploy-to-control-plane.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,30 @@ jobs:
9292

9393
- name: Checkout PR Branch
9494
if: |
95-
github.event_name == 'issue_comment' ||
95+
(github.event_name == 'issue_comment' &&
96+
github.event.issue.pull_request &&
97+
github.event.comment.body == '/deploy-review-app') ||
9698
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
9799
run: git checkout ${{ steps.getRef.outputs.PR_REF }}
98100

101+
- name: Build Docker Image
102+
if: |
103+
(github.event_name == 'issue_comment' &&
104+
github.event.issue.pull_request &&
105+
github.event.comment.body == '/deploy-review-app') ||
106+
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
107+
uses: ./.github/actions/build-docker-image
108+
with:
109+
app_name: ${{ env.APP_NAME }}
110+
org: ${{ env.CPLN_ORG }}
111+
commit: ${{ steps.getRef.outputs.PR_SHA }}
112+
PR_NUMBER: ${{ env.PR_NUMBER }}
113+
99114
- name: Deploy to Control Plane
100115
if: |
101-
github.event_name == 'issue_comment' ||
116+
(github.event_name == 'issue_comment' &&
117+
github.event.issue.pull_request &&
118+
github.event.comment.body == '/deploy-review-app') ||
102119
(steps.get-pr.outputs.has_pr == 'true' && steps.check-app.outputs.app_exists == 'true')
103120
uses: ./.github/actions/deploy-to-control-plane
104121
with:

0 commit comments

Comments
 (0)