Skip to content

Commit fba5fce

Browse files
Merge pull request #132 from kamranahmedse/master
Create a new pull request by comparing changes across two branches
2 parents c0c8f8a + 91dc6b8 commit fba5fce

File tree

80 files changed

+2638
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2638
-356
lines changed

.github/workflows/deployment.yml

Lines changed: 69 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,74 @@
1-
name: App Deployment
1+
name: Deploy to EC2
22
on:
3+
workflow_dispatch: # allow manual run
34
push:
4-
branches: [ master ]
5-
env:
6-
PUBLIC_API_URL: "https://api.roadmap.sh"
7-
PUBLIC_EDITOR_APP_URL: "https://draw.roadmap.sh"
8-
PUBLIC_AVATAR_BASE_URL: "https://dodrc8eu8m09s.cloudfront.net/avatars"
9-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
CI: true
5+
branches:
6+
- master
117
jobs:
12-
build:
8+
deploy:
139
runs-on: ubuntu-latest
1410
steps:
15-
- uses: actions/checkout@v4
16-
with:
17-
persist-credentials: false
18-
- uses: actions/setup-node@v1
19-
with:
20-
node-version: 18
21-
- name: Prepare Draw Repository
22-
run: |
23-
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/web-draw.git .temp/web-draw --depth 1
24-
- uses: pnpm/[email protected]
25-
with:
26-
version: 7.13.4
27-
- name: Setup Environment
28-
run: |
29-
pnpm install
30-
- name: Generate meta and build
31-
run: |
32-
npm run generate-renderer
33-
npm run build
34-
touch ./dist/.nojekyll
35-
echo 'roadmap.sh' > ./dist/CNAME
36-
- name: Deploy to GH Pages
37-
run: |
38-
git config user.email "[email protected]"
39-
git config user.name "Kamran Ahmed"
40-
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
41-
npm run deploy
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 20
18+
- uses: pnpm/[email protected]
19+
with:
20+
version: 8.15.6
21+
22+
# --------------------
23+
# Setup configuration
24+
# --------------------
25+
- name: Prepare configuration files
26+
run: |
27+
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/infra-config.git configuration --depth 1
28+
- name: Copy configuration files
29+
run: |
30+
cp configuration/dist/github/developer-roadmap.env .env
31+
32+
# --------------------
33+
# Prepare the build
34+
# --------------------
35+
- name: Install dependencies
36+
run: |
37+
pnpm install
38+
- name: Generate build
39+
run: |
40+
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/web-draw.git .temp/web-draw --depth 1
41+
npm run generate-renderer
42+
npm run build
43+
44+
# --------------------
45+
# Deploy to EC2
46+
# --------------------
47+
- uses: webfactory/[email protected]
48+
with:
49+
ssh-private-key: ${{ secrets.EC2_PRIVATE_KEY }}
50+
- name: Deploy app to EC2
51+
run: |
52+
rsync -apvz --delete --no-times --exclude "configuration" -e "ssh -o StrictHostKeyChecking=no" -p ./ ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/var/www/roadmap.sh/
53+
- name: Restart PM2
54+
uses: appleboy/ssh-action@master
55+
with:
56+
host: ${{ secrets.EC2_HOST }}
57+
username: ${{ secrets.EC2_USERNAME }}
58+
key: ${{ secrets.EC2_PRIVATE_KEY }}
59+
script: |
60+
cd /var/www/roadmap.sh
61+
sudo pm2 restart web-roadmap
62+
63+
# --------------------
64+
# Clear Cloudfront Caching
65+
# --------------------
66+
- name: Clear Cloudfront Caching
67+
run: |
68+
curl -L \
69+
-X POST \
70+
-H "Accept: application/vnd.github+json" \
71+
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
72+
-H "X-GitHub-Api-Version: 2022-11-28" \
73+
https://api.github.com/repos/roadmapsh/infra-ansible/actions/workflows/playbook.yml/dispatches \
74+
-d '{ "ref":"master", "inputs": { "playbook": "roadmap_web.yml", "tags": "cloudfront", "is_verbose": false } }'

astro.config.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// https://astro.build/config
22
import sitemap from '@astrojs/sitemap';
33
import tailwind from '@astrojs/tailwind';
4+
import node from '@astrojs/node';
45
import compress from 'astro-compress';
56
import { defineConfig } from 'astro/config';
67
import rehypeExternalLinks from 'rehype-external-links';
7-
import { fileURLToPath } from 'node:url';
88
import { serializeSitemap, shouldIndexPage } from './sitemap.mjs';
99

1010
import react from '@astrojs/react';
@@ -41,9 +41,11 @@ export default defineConfig({
4141
],
4242
],
4343
},
44-
build: {
45-
format: 'file',
46-
},
44+
output: 'hybrid',
45+
adapter: node({
46+
mode: 'standalone',
47+
}),
48+
trailingSlash: 'never',
4749
integrations: [
4850
tailwind({
4951
config: {

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test:e2e": "playwright test"
2424
},
2525
"dependencies": {
26+
"@astrojs/node": "^8.2.1",
2627
"@astrojs/react": "^3.0.10",
2728
"@astrojs/sitemap": "^3.0.5",
2829
"@astrojs/tailwind": "^5.1.0",
@@ -34,6 +35,7 @@
3435
"astro": "^4.4.0",
3536
"astro-compress": "^2.2.10",
3637
"clsx": "^2.1.0",
38+
"dayjs": "^1.11.10",
3739
"dom-to-image": "^2.6.0",
3840
"dracula-prism": "^2.1.16",
3941
"gray-matter": "^4.0.3",
@@ -48,8 +50,10 @@
4850
"npm-check-updates": "^16.14.15",
4951
"prismjs": "^1.29.0",
5052
"react": "^18.2.0",
53+
"react-calendar-heatmap": "^1.9.0",
5154
"react-confetti": "^6.1.0",
5255
"react-dom": "^18.2.0",
56+
"react-tooltip": "^5.26.3",
5357
"reactflow": "^11.10.4",
5458
"rehype-external-links": "^3.0.0",
5559
"remark-parse": "^11.0.0",
@@ -69,6 +73,7 @@
6973
"@types/dom-to-image": "^2.6.7",
7074
"@types/js-cookie": "^3.0.6",
7175
"@types/prismjs": "^1.26.3",
76+
"@types/react-calendar-heatmap": "^1.6.7",
7277
"csv-parser": "^3.0.0",
7378
"gh-pages": "^6.1.1",
7479
"js-yaml": "^4.1.0",

0 commit comments

Comments
 (0)