mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-09-24 15:00:31 +08:00
* Update * Add stats and health endpoints * Add pre-render * fix: redirect to the error page * Fix generate-renderer issue * Rename * Fix best practice topics not loading * Handle SSR for static pages * Refactor faqs * Refactor best practices * Fix absolute import * Fix stats * Add custom roadmap page * Minor UI change * feat: custom roadmap slug routes (#4987) * feat: replace roadmap slug * fix: remove roadmap slug * feat: username route * fix: user public page * feat: show roadmap progress * feat: update public profile * fix: replace with toast * feat: user public profile page * feat: implement profile form * feat: implement user profile roadmap page * refactor: remove logs * fix: increase progress gap * fix: remove title margin * fix: breakpoint for roadmaps * Update dependencies * Upgrade dependencies * fix: improper avatars * fix: heatmap focus * wip: remove `getStaticPaths` * fix: add disable props * wip * feat: add email icon * fix: update pnpm lock * fix: implement author page * Fix beginner roadmaps not working * Changes to form * Refactor profile and form * Refactor public profile form * Rearrange sidebar items * Update UI for public form * Minor text update * Refactor public profile form * Error page for user * Revamp UI for profile page * Add public profile page * Fix vite warnings * Add private profile banner * feat: on blur check username * Update fetch depth * Add error detail * Use hybrid mode of rendering * Do not pre-render stats pages * Update deployment workflow * Update deployment workflow --------- Co-authored-by: Arik Chakma <arikchangma@gmail.com>
74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
name: Deploy to EC2
|
|
on:
|
|
workflow_dispatch: # allow manual run
|
|
push:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 2
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20
|
|
- uses: pnpm/action-setup@v3.0.0
|
|
with:
|
|
version: 8.15.6
|
|
|
|
# --------------------
|
|
# Setup configuration
|
|
# --------------------
|
|
- name: Prepare configuration files
|
|
run: |
|
|
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/infra-config.git configuration --depth 1
|
|
- name: Copy configuration files
|
|
run: |
|
|
cp configuration/dist/github/developer-roadmap.env .env
|
|
|
|
# --------------------
|
|
# Prepare the build
|
|
# --------------------
|
|
- name: Install dependencies
|
|
run: |
|
|
pnpm install
|
|
- name: Generate build
|
|
run: |
|
|
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/web-draw.git .temp/web-draw --depth 1
|
|
npm run generate-renderer
|
|
npm run build
|
|
|
|
# --------------------
|
|
# Deploy to EC2
|
|
# --------------------
|
|
- uses: webfactory/ssh-agent@v0.7.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.EC2_PRIVATE_KEY }}
|
|
- name: Deploy app to EC2
|
|
run: |
|
|
rsync -apvz --delete --no-times --exclude "configuration" -e "ssh -o StrictHostKeyChecking=no" -p ./ ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/var/www/roadmap.sh/
|
|
- name: Restart PM2
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.EC2_HOST }}
|
|
username: ${{ secrets.EC2_USERNAME }}
|
|
key: ${{ secrets.EC2_PRIVATE_KEY }}
|
|
script: |
|
|
cd /var/www/roadmap.sh
|
|
sudo pm2 restart web-roadmap
|
|
|
|
# --------------------
|
|
# Clear Cloudfront Caching
|
|
# --------------------
|
|
- name: Clear Cloudfront Caching
|
|
run: |
|
|
curl -L \
|
|
-X POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/roadmapsh/infra-ansible/actions/workflows/playbook.yml/dispatches \
|
|
-d '{ "ref":"master", "inputs": { "playbook": "roadmap_web.yml", "tags": "cloudfront", "is_verbose": false } }' |