-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (96 loc) · 3.21 KB
/
pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Staging and production deployment
on:
push:
branches:
- main
- production
jobs:
test:
runs-on: ubuntu-latest
steps:
# Your existing test steps from the original workflow would go here
- name: Placeholder for existing test steps
run: echo "Your existing test steps would go here"
deploy-production:
# needs: test # This ensures deployment only happens after tests pass
if: github.ref == 'refs/heads/production' # Only run this job for production branch
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build Vue3 project
run: npm run build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy to remote server
run: |
rsync -avz --delete dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/virtual/ut/lacune-map.de
- name: Send deployment notification
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ secrets.SMTP_SERVER }}
server_port: ${{ secrets.SMTP_PORT }}
username: ${{ secrets.SMTP_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: Lacune Map production deployment complete
body: |
A new deployment to production has been completed.
Branch: production
Commit: ${{ github.sha }}
Timestamp: ${{ github.event.head_commit.timestamp }}
Changes:
${{ github.event.head_commit.message }}
from: ${{ secrets.MAIL_FROM }}
to: ${{ secrets.MAIL_TO }}
secure: true
deploy-staging:
# needs: test # This ensures deployment only happens after tests pass
if: github.ref == 'refs/heads/main' # Only run this job for main branch
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node: [20]
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout code 📔
uses: actions/checkout@master
- name: Setup node env 🪑
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Print node-version 🖨
run: node -v
- name: Install dependencies 📦
run: npm install
- name: Generate 🔩
run: npm run build
env:
PUBLIC_PATH: '/lacune-map/'
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './dist'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to GitHub Pages 🏁
id: deployment
uses: actions/deploy-pages@v4