Skip to content

Commit bce67a3

Browse files
authored
Merge pull request #217 from Resgrid/develop
RU-T42 Docker build fix
2 parents 2d9f35c + 04bc441 commit bce67a3

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

.github/workflows/react-native-cicd.yml

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
needs: test
121121
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
122122
permissions:
123-
contents: write # Required for creating releases
123+
contents: write # Required for creating releases
124124
strategy:
125125
matrix:
126126
platform: [android, ios]
@@ -130,6 +130,34 @@ jobs:
130130
- name: 🏗 Checkout repository
131131
uses: actions/checkout@v4
132132

133+
- name: 🧹 Free up disk space (Android)
134+
if: matrix.platform == 'android'
135+
run: |
136+
echo "Disk space before cleanup:"
137+
df -h
138+
139+
# Remove unnecessary large packages
140+
sudo rm -rf /usr/share/dotnet
141+
sudo rm -rf /opt/ghc
142+
sudo rm -rf /usr/local/share/boost
143+
sudo rm -rf /usr/share/swift
144+
sudo rm -rf /usr/local/.ghcup
145+
sudo rm -rf /usr/lib/jvm/temurin-11-jdk-amd64
146+
147+
# Remove Docker images
148+
docker system prune -af || true
149+
150+
# Remove cached apt packages
151+
sudo apt-get clean || true
152+
sudo rm -rf /var/lib/apt/lists/*
153+
154+
# Remove swap
155+
sudo swapoff -a || true
156+
sudo rm -f /swapfile || true
157+
158+
echo "Disk space after cleanup:"
159+
df -h
160+
133161
- name: 🏗 Setup Node.js
134162
uses: actions/setup-node@v4
135163
with:
@@ -307,17 +335,17 @@ jobs:
307335
if: ${{ matrix.platform == 'android' }}
308336
run: |
309337
set -eo pipefail
310-
338+
311339
# Check if required secrets are set
312340
if [ -z "$CHANGERAWR_API_URL" ] || [ -z "$CHANGERAWR_API_KEY" ]; then
313341
echo "⚠️ Changerawr API credentials not configured, skipping release notes submission"
314342
exit 0
315343
fi
316-
344+
317345
# Read release notes
318346
RELEASE_NOTES=$(cat RELEASE_NOTES.md)
319347
VERSION="7.${{ github.run_number }}"
320-
348+
321349
# Prepare JSON payload
322350
PAYLOAD=$(jq -n \
323351
--arg version "$VERSION" \
@@ -327,20 +355,20 @@ jobs:
327355
"title": ("Release v" + $version),
328356
"content": $notes
329357
}')
330-
358+
331359
echo "Sending release notes to Changerawr..."
332-
360+
333361
# Send to Changerawr API
334362
RESPONSE=$(curl -X POST "$CHANGERAWR_API_URL" \
335363
-H "Content-Type: application/json" \
336364
-H "Authorization: Bearer $CHANGERAWR_API_KEY" \
337365
-d "$PAYLOAD" \
338366
-w "\n%{http_code}" \
339367
-s)
340-
368+
341369
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
342370
RESPONSE_BODY=$(echo "$RESPONSE" | sed '$d')
343-
371+
344372
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
345373
echo "✅ Successfully sent release notes to Changerawr (HTTP $HTTP_CODE)"
346374
echo "Response: $RESPONSE_BODY"
@@ -397,6 +425,21 @@ jobs:
397425
yarn web:build
398426
env:
399427
NODE_ENV: production
428+
APP_ENV: production
429+
# Unset DISPATCH_* env vars for web build to use defaults from env.js
430+
# Actual values will be injected at Docker container runtime via envsubst
431+
UNIT_BASE_API_URL: ''
432+
UNIT_API_VERSION: ''
433+
UNIT_RESGRID_API_URL: ''
434+
UNIT_CHANNEL_HUB_NAME: ''
435+
UNIT_REALTIME_GEO_HUB_NAME: ''
436+
UNIT_LOGGING_KEY: ''
437+
UNIT_APP_KEY: ''
438+
UNIT_MAPBOX_PUBKEY: ''
439+
UNIT_MAPBOX_DLKEY: ''
440+
UNIT_SENTRY_DSN: ''
441+
UNIT_COUNTLY_APP_KEY: ''
442+
UNIT_COUNTLY_SERVER_URL: ''
400443

401444
- name: 📦 Upload web build artifacts
402445
uses: actions/upload-artifact@v4
@@ -410,7 +453,7 @@ jobs:
410453
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
411454
permissions:
412455
contents: read
413-
packages: write # Required for pushing to GHCR
456+
packages: write # Required for pushing to GHCR
414457
runs-on: ubuntu-latest
415458
environment: RNBuild
416459
steps:
@@ -447,9 +490,7 @@ jobs:
447490
id: meta
448491
uses: docker/metadata-action@v5
449492
with:
450-
images: |
451-
${{ steps.docker-creds.outputs.available == 'true' && format('{0}/resgrid-unit', secrets.DOCKER_USERNAME) || '' }}
452-
ghcr.io/${{ github.repository }}
493+
images: resgridllc/unit
453494
tags: |
454495
type=raw,value=7.${{ github.run_number }}
455496
type=raw,value=latest
@@ -473,7 +514,7 @@ jobs:
473514
needs: test
474515
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
475516
permissions:
476-
contents: write # Required for creating releases
517+
contents: write # Required for creating releases
477518
strategy:
478519
matrix:
479520
os: [windows-latest, macos-15, ubuntu-latest]
@@ -592,7 +633,7 @@ jobs:
592633
needs: build-electron
593634
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
594635
permissions:
595-
contents: write # Required for creating releases
636+
contents: write # Required for creating releases
596637
runs-on: ubuntu-latest
597638
environment: RNBuild
598639
steps:
@@ -616,11 +657,11 @@ jobs:
616657
echo "Error: No Electron artifacts found in electron-artifacts/ directory."
617658
exit 1
618659
fi
619-
660+
620661
# Create release-artifacts directory and copy files using null-delimited find/xargs
621662
mkdir -p release-artifacts
622663
find electron-artifacts/ -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \) -print0 | xargs -0 cp -t release-artifacts/
623-
664+
624665
echo "Release artifacts prepared:"
625666
ls -lh release-artifacts/
626667
@@ -634,4 +675,3 @@ jobs:
634675
name: '7.${{ github.run_number }}'
635676
artifacts: 'release-artifacts/*'
636677
bodyFile: 'RELEASE_NOTES.md'
637-

0 commit comments

Comments
 (0)