We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a8b371 commit 55858c6Copy full SHA for 55858c6
.github/workflows/blank.yml
@@ -0,0 +1,34 @@
1
+name: Deploy to EC2
2
+
3
+on:
4
+ push:
5
+ branches: [main]
6
7
+jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
11
+ steps:
12
+ - name: Deploy nginx to EC2
13
+ uses: appleboy/ssh-action@v1.0.3
14
+ with:
15
+ host: ${{ secrets.EC2_HOST }}
16
+ username: ${{ secrets.EC2_USER }}
17
+ key: ${{ secrets.EC2_SSH_KEY }}
18
+ script: |
19
+ sudo apt-get update -y -q
20
+ sudo apt-get install -y -q nginx
21
22
+ sudo tee /var/www/html/index.html > /dev/null <<'EOF'
23
+ <!DOCTYPE html>
24
+ <html>
25
+ <head><title>Hello World</title></head>
26
+ <body>
27
+ <h1>Hello World from EC2!</h1>
28
+ <p>Deployed via GitHub Actions.</p>
29
+ </body>
30
+ </html>
31
+ EOF
32
33
+ sudo systemctl enable nginx
34
+ sudo systemctl start nginx
0 commit comments