cleaning #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Frontend Challenges | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
# Uncomment and configure AWS credentials if needed | |
# - name: Configure AWS credentials | |
# uses: aws-actions/configure-aws-credentials@v1 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# aws-region: us-east-1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install platform-specific packages | |
run: | | |
npm install @rollup/rollup-linux-x64-gnu | |
npm i --save-dev @types/node | |
- name: Build and Report | |
id: build-challenges | |
run: | | |
success_problems=() | |
failed_problems=() | |
for problem in problems/*; do | |
if [ -d "$problem" ]; then | |
problem_name=$(basename "$problem") | |
echo "Building $problem_name" | |
cd "$problem/solutions/react-ts" | |
if npm ci && npm run build; then | |
echo "$problem_name build succeeded" | |
success_problems+=("$problem_name") | |
# Uncomment and configure S3 sync if needed | |
# aws s3 sync build/ s3://your-bucket-name/$problem_name/ --delete | |
else | |
echo "$problem_name build failed" | |
failed_problems+=("$problem_name") | |
fi | |
cd ../../../../ | |
fi | |
done | |
# Write summary to GITHUB_STEP_SUMMARY with links | |
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "| Challenge Name | Demo | Status |" >> $GITHUB_STEP_SUMMARY | |
echo "|----------------|------|--------|" >> $GITHUB_STEP_SUMMARY | |
base_url="https://frontendproblems.vercel.app" | |
for problem in "${success_problems[@]}"; do | |
echo "| $problem | [Link]($base_url/$problem) | ✅ |" >> $GITHUB_STEP_SUMMARY | |
done | |
for problem in "${failed_problems[@]}"; do | |
echo "| $problem | - | ❌ |" >> $GITHUB_STEP_SUMMARY | |
done | |
# Uncomment and configure CloudFront invalidation if needed | |
# - name: Invalidate CloudFront | |
# run: | | |
# aws cloudfront create-invalidation --distribution-id YOUR_DISTRIBUTION_ID --paths "/*" |