Skip to content

Commit ce737dd

Browse files
committed
RU-T47 PR#202 Fixes
1 parent f1f8423 commit ce737dd

File tree

10 files changed

+257
-287
lines changed

10 files changed

+257
-287
lines changed

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

Lines changed: 32 additions & 254 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
cache: 'yarn'
102102

103103
- name: 📦 Setup yarn cache
104-
uses: actions/cache@v3
104+
uses: actions/cache@v4
105105
with:
106106
path: |
107107
~/.cache/yarn
@@ -144,7 +144,7 @@ jobs:
144144
token: ${{ secrets.EXPO_TOKEN }}
145145

146146
- name: 📦 Setup yarn cache
147-
uses: actions/cache@v3
147+
uses: actions/cache@v4
148148
with:
149149
path: |
150150
~/.cache/yarn
@@ -197,7 +197,7 @@ jobs:
197197
fi
198198
199199
- name: 📱 Setup EAS build cache
200-
uses: actions/cache@v3
200+
uses: actions/cache@v4
201201
with:
202202
path: ~/.eas-build-local
203203
key: ${{ runner.os }}-eas-build-local-${{ hashFiles('**/package.json') }}
@@ -301,126 +301,7 @@ jobs:
301301
302302
- name: 📋 Prepare Release Notes file
303303
if: ${{ matrix.platform == 'android' }}
304-
run: |
305-
set -eo pipefail
306-
307-
# Function to extract release notes from PR body
308-
extract_release_notes() {
309-
local body="$1"
310-
311-
# First pass: Remove everything between CodeRabbit comment markers using sed
312-
# This handles multi-line auto-generated content
313-
local cleaned_body="$(printf '%s\n' "$body" \
314-
| sed '/<!-- This is an auto-generated comment: release notes by coderabbit.ai -->/,/<!-- end of auto-generated comment: release notes by coderabbit.ai -->/d')"
315-
316-
# Second pass: Remove the "Summary by CodeRabbit" section
317-
cleaned_body="$(printf '%s\n' "$cleaned_body" \
318-
| awk '
319-
BEGIN { skip=0 }
320-
/^## Summary by CodeRabbit/ { skip=1; next }
321-
/^## / && skip==1 { skip=0 }
322-
skip==0 { print }
323-
')"
324-
325-
# Third pass: Remove any remaining HTML comment lines
326-
cleaned_body="$(printf '%s\n' "$cleaned_body" | sed '/^<!--.*-->$/d' | sed '/^<!--/d' | sed '/^-->$/d')"
327-
328-
# Fourth pass: Remove specific CodeRabbit lines
329-
cleaned_body="$(printf '%s\n' "$cleaned_body" \
330-
| (grep -v '✏️ Tip: You can customize this high-level summary in your review settings\.' || true) \
331-
| (grep -v '<!-- This is an auto-generated comment: release notes by coderabbit.ai -->' || true) \
332-
| (grep -v '<!-- end of auto-generated comment: release notes by coderabbit.ai -->' || true))"
333-
334-
# Fifth pass: Trim leading and trailing whitespace/empty lines
335-
cleaned_body="$(printf '%s\n' "$cleaned_body" | sed '/^$/d' | awk 'NF {p=1} p')"
336-
337-
# Try to extract content under "## Release Notes" heading if it exists
338-
local notes="$(printf '%s\n' "$cleaned_body" \
339-
| awk 'f && /^## /{exit} /^## Release Notes/{f=1; next} f')"
340-
341-
# If no specific "Release Notes" section found, use the entire cleaned body
342-
if [ -z "$notes" ]; then
343-
notes="$cleaned_body"
344-
fi
345-
346-
# Final trim
347-
notes="$(printf '%s\n' "$notes" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
348-
349-
printf '%s\n' "$notes"
350-
}
351-
352-
# Determine source of release notes
353-
NOTES=""
354-
355-
# Check if this was triggered by a push event (likely a merge)
356-
if [ "${{ github.event_name }}" = "push" ]; then
357-
echo "Fetching PR body for merged commit..."
358-
359-
# First, try to find PR number from commit message (most reliable)
360-
PR_FROM_COMMIT=$(git log -1 --pretty=%B | grep -oE '#[0-9]+' | head -1 | tr -d '#' || echo "")
361-
362-
if [ -n "$PR_FROM_COMMIT" ]; then
363-
echo "Found PR #$PR_FROM_COMMIT from commit message"
364-
PR_BODY=$(gh pr view "$PR_FROM_COMMIT" --json body --jq '.body' 2>/dev/null || echo "")
365-
366-
if [ -n "$PR_BODY" ]; then
367-
echo "PR body length: ${#PR_BODY}"
368-
NOTES="$(extract_release_notes "$PR_BODY")"
369-
echo "Extracted notes length: ${#NOTES}"
370-
else
371-
echo "Warning: PR body is empty"
372-
fi
373-
else
374-
echo "No PR reference in commit message, searching by commit SHA..."
375-
# Get PRs that contain this commit (using GitHub API to search by commit)
376-
PR_NUMBERS=$(gh api \
377-
"repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
378-
--jq '.[].number' 2>/dev/null || echo "")
379-
380-
if [ -n "$PR_NUMBERS" ]; then
381-
# Take the first PR found (most recently merged)
382-
PR_NUMBER=$(echo "$PR_NUMBERS" | head -n 1)
383-
echo "Found PR #$PR_NUMBER associated with commit"
384-
385-
# Fetch the PR body
386-
PR_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body' 2>/dev/null || echo "")
387-
388-
if [ -n "$PR_BODY" ]; then
389-
echo "PR body length: ${#PR_BODY}"
390-
NOTES="$(extract_release_notes "$PR_BODY")"
391-
echo "Extracted notes length: ${#NOTES}"
392-
else
393-
echo "Warning: PR body is empty"
394-
fi
395-
else
396-
echo "No associated PR found for this commit"
397-
fi
398-
fi
399-
fi
400-
401-
# Fallback to recent commits if no PR body found (skip merge commits)
402-
if [ -z "$NOTES" ]; then
403-
echo "No PR body found, using recent commits (excluding merge commits)..."
404-
NOTES="$(git log -n 10 --pretty=format:'- %s' --no-merges | head -n 5)"
405-
fi
406-
407-
# Fail if no notes extracted
408-
if [ -z "$NOTES" ]; then
409-
echo "Error: No release notes extracted" >&2
410-
exit 1
411-
fi
412-
413-
# Write header and notes to file
414-
{
415-
echo "## Version 7.${{ github.run_number }} - $(date +%Y-%m-%d)"
416-
echo
417-
printf '%s\n' "$NOTES"
418-
} > RELEASE_NOTES.md
419-
420-
echo "Release notes prepared:"
421-
cat RELEASE_NOTES.md
422-
env:
423-
GH_TOKEN: ${{ github.token }}
304+
run: ./scripts/extract-release-notes.sh "7.${{ github.run_number }}" "${{ github.event_name }}" "${{ github.repository }}" "${{ github.sha }}" "${{ github.token }}"
424305

425306
- name: 📝 Send Release Notes to Changerawr
426307
if: ${{ matrix.platform == 'android' }}
@@ -483,6 +364,8 @@ jobs:
483364
build-web:
484365
needs: test
485366
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
367+
permissions:
368+
contents: read
486369
runs-on: ubuntu-latest
487370
environment: RNBuild
488371
steps:
@@ -496,7 +379,7 @@ jobs:
496379
cache: 'yarn'
497380

498381
- name: 📦 Setup yarn cache
499-
uses: actions/cache@v3
382+
uses: actions/cache@v4
500383
with:
501384
path: |
502385
~/.cache/yarn
@@ -607,7 +490,7 @@ jobs:
607490
cache: 'yarn'
608491

609492
- name: 📦 Setup yarn cache
610-
uses: actions/cache@v3
493+
uses: actions/cache@v4
611494
with:
612495
path: |
613496
~/.cache/yarn
@@ -702,151 +585,45 @@ jobs:
702585
electron-dist/*.rpm
703586
retention-days: 7
704587

588+
release-electron:
589+
needs: build-electron
590+
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'workflow_dispatch'
591+
permissions:
592+
contents: write # Required for creating releases
593+
runs-on: ubuntu-latest
594+
environment: RNBuild
595+
steps:
596+
- name: 🏗 Checkout repository
597+
uses: actions/checkout@v4
598+
705599
- name: 📋 Prepare Release Notes file
706-
if: ${{ matrix.os == 'ubuntu-latest' }}
707-
run: |
708-
set -eo pipefail
709-
710-
# Function to extract release notes from PR body
711-
extract_release_notes() {
712-
local body="$1"
713-
714-
# First pass: Remove everything between CodeRabbit comment markers using sed
715-
# This handles multi-line auto-generated content
716-
local cleaned_body="$(printf '%s\n' "$body" \
717-
| sed '/<!-- This is an auto-generated comment: release notes by coderabbit.ai -->/,/<!-- end of auto-generated comment: release notes by coderabbit.ai -->/d')"
718-
719-
# Second pass: Remove the "Summary by CodeRabbit" section
720-
cleaned_body="$(printf '%s\n' "$cleaned_body" \
721-
| awk '
722-
BEGIN { skip=0 }
723-
/^## Summary by CodeRabbit/ { skip=1; next }
724-
/^## / && skip==1 { skip=0 }
725-
skip==0 { print }
726-
')"
727-
728-
# Third pass: Remove any remaining HTML comment lines
729-
cleaned_body="$(printf '%s\n' "$cleaned_body" | sed '/^<!--.*-->$/d' | sed '/^<!--/d' | sed '/^-->$/d')"
730-
731-
# Fourth pass: Remove specific CodeRabbit lines
732-
cleaned_body="$(printf '%s\n' "$cleaned_body" \
733-
| (grep -v '✏️ Tip: You can customize this high-level summary in your review settings\.' || true) \
734-
| (grep -v '<!-- This is an auto-generated comment: release notes by coderabbit.ai -->' || true) \
735-
| (grep -v '<!-- end of auto-generated comment: release notes by coderabbit.ai -->' || true))"
736-
737-
# Fifth pass: Trim leading and trailing whitespace/empty lines
738-
cleaned_body="$(printf '%s\n' "$cleaned_body" | sed '/^$/d' | awk 'NF {p=1} p')"
739-
740-
# Try to extract content under "## Release Notes" heading if it exists
741-
local notes="$(printf '%s\n' "$cleaned_body" \
742-
| awk 'f && /^## /{exit} /^## Release Notes/{f=1; next} f')"
743-
744-
# If no specific "Release Notes" section found, use the entire cleaned body
745-
if [ -z "$notes" ]; then
746-
notes="$cleaned_body"
747-
fi
748-
749-
# Final trim
750-
notes="$(printf '%s\n' "$notes" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
751-
752-
printf '%s\n' "$notes"
753-
}
754-
755-
# Determine source of release notes
756-
NOTES=""
757-
758-
# Check if this was triggered by a push event (likely a merge)
759-
if [ "${{ github.event_name }}" = "push" ]; then
760-
echo "Fetching PR body for merged commit..."
761-
762-
# First, try to find PR number from commit message (most reliable)
763-
PR_FROM_COMMIT=$(git log -1 --pretty=%B | grep -oE '#[0-9]+' | head -1 | tr -d '#' || echo "")
764-
765-
if [ -n "$PR_FROM_COMMIT" ]; then
766-
echo "Found PR #$PR_FROM_COMMIT from commit message"
767-
PR_BODY=$(gh pr view "$PR_FROM_COMMIT" --json body --jq '.body' 2>/dev/null || echo "")
768-
769-
if [ -n "$PR_BODY" ]; then
770-
echo "PR body length: ${#PR_BODY}"
771-
NOTES="$(extract_release_notes "$PR_BODY")"
772-
echo "Extracted notes length: ${#NOTES}"
773-
else
774-
echo "Warning: PR body is empty"
775-
fi
776-
else
777-
echo "No PR reference in commit message, searching by commit SHA..."
778-
# Get PRs that contain this commit (using GitHub API to search by commit)
779-
PR_NUMBERS=$(gh api \
780-
"repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
781-
--jq '.[].number' 2>/dev/null || echo "")
782-
783-
if [ -n "$PR_NUMBERS" ]; then
784-
# Take the first PR found (most recently merged)
785-
PR_NUMBER=$(echo "$PR_NUMBERS" | head -n 1)
786-
echo "Found PR #$PR_NUMBER associated with commit"
787-
788-
# Fetch the PR body
789-
PR_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body' 2>/dev/null || echo "")
790-
791-
if [ -n "$PR_BODY" ]; then
792-
echo "PR body length: ${#PR_BODY}"
793-
NOTES="$(extract_release_notes "$PR_BODY")"
794-
echo "Extracted notes length: ${#NOTES}"
795-
else
796-
echo "Warning: PR body is empty"
797-
fi
798-
else
799-
echo "No associated PR found for this commit"
800-
fi
801-
fi
802-
fi
803-
804-
# Fallback to recent commits if no PR body found (skip merge commits)
805-
if [ -z "$NOTES" ]; then
806-
echo "No PR body found, using recent commits (excluding merge commits)..."
807-
NOTES="$(git log -n 10 --pretty=format:'- %s' --no-merges | head -n 5)"
808-
fi
809-
810-
# Fail if no notes extracted
811-
if [ -z "$NOTES" ]; then
812-
echo "Error: No release notes extracted" >&2
813-
exit 1
814-
fi
815-
816-
# Write header and notes to file
817-
{
818-
echo "## Version 7.${{ github.run_number }} - $(date +%Y-%m-%d)"
819-
echo
820-
printf '%s\n' "$NOTES"
821-
} > RELEASE_NOTES.md
822-
823-
echo "Release notes prepared:"
824-
cat RELEASE_NOTES.md
825-
env:
826-
GH_TOKEN: ${{ github.token }}
600+
run: ./scripts/extract-release-notes.sh "7.${{ github.run_number }}" "${{ github.event_name }}" "${{ github.repository }}" "${{ github.sha }}" "${{ github.token }}"
827601

828-
- name: � Download all Electron artifacts
829-
if: ${{ matrix.os == 'ubuntu-latest' }}
602+
- name: 📥 Download all Electron artifacts
830603
uses: actions/download-artifact@v4
831604
with:
832605
path: electron-artifacts/
833606
pattern: electron-*
834607
merge-multiple: false
835608

836609
- name: 📦 Prepare Electron release artifacts
837-
if: ${{ matrix.os == 'ubuntu-latest' }}
838610
run: |
839-
# Create release-artifacts directory
840-
mkdir -p release-artifacts
611+
# Find all matching Electron artifacts
612+
FILES=$(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" \))
613+
614+
if [ -z "$FILES" ]; then
615+
echo "Error: No Electron artifacts found in electron-artifacts/ directory."
616+
exit 1
617+
fi
841618
842-
# Copy all Electron artifacts to a flat directory for release
843-
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" \) -exec cp {} release-artifacts/ \;
619+
# Create release-artifacts directory and copy files
620+
mkdir -p release-artifacts
621+
echo "$FILES" | xargs -I {} cp {} release-artifacts/
844622
845623
echo "Release artifacts prepared:"
846624
ls -lh release-artifacts/
847625
848626
- name: 📦 Create GitHub Release with Electron builds
849-
if: ${{ matrix.os == 'ubuntu-latest' }}
850627
uses: ncipollo/release-action@v1
851628
with:
852629
tag: '7.${{ github.run_number }}'
@@ -856,3 +633,4 @@ jobs:
856633
name: '7.${{ github.run_number }}'
857634
artifacts: 'release-artifacts/*'
858635
bodyFile: 'RELEASE_NOTES.md'
636+

app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
107107
[
108108
'@rnmapbox/maps',
109109
{
110-
RNMapboxMapsVersion: '11.8.0',
110+
RNMapboxMapsVersion: '11.16.2',
111111
},
112112
],
113113
[

nginx.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ http {
3838
# Security headers
3939
add_header X-Frame-Options "SAMEORIGIN" always;
4040
add_header X-Content-Type-Options "nosniff" always;
41-
add_header X-XSS-Protection "1; mode=block" always;
41+
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self';" always;
4242

4343
# Static assets with cache
4444
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
4545
expires 1y;
4646
add_header Cache-Control "public, immutable";
4747
add_header X-Frame-Options "SAMEORIGIN" always;
4848
add_header X-Content-Type-Options "nosniff" always;
49-
add_header X-XSS-Protection "1; mode=block" always;
49+
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self';" always;
5050
try_files $uri =404;
5151
}
5252

@@ -58,8 +58,8 @@ http {
5858
# Health check endpoint
5959
location /health {
6060
access_log off;
61-
return 200 "healthy\n";
6261
add_header Content-Type text/plain;
62+
return 200 "healthy\n";
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)