-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (142 loc) · 4.48 KB
/
deploy.yml
File metadata and controls
157 lines (142 loc) · 4.48 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Deploy Hugo Site
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.155.1
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Node dependencies
run: |
if [ -f package.json ]; then
npm install
fi
- name: Create data directory
run: mkdir -p data
- name: Update community stats
run: |
if [ -f .github/scripts/fetch-discourse-activity.js ]; then
echo "Running Discourse activity script..."
node .github/scripts/fetch-discourse-activity.js || {
echo "Discourse script failed, creating fallback data..."
cat > data/community_stats.json << 'EOF'
{
"activities": [
{
"message": "PowerShell 7.4.1 released with security updates",
"time": "Last week",
"type": "release",
"color": "bg-green-500"
},
{
"message": "New Azure PowerShell module available",
"time": "2 weeks ago",
"type": "update",
"color": "bg-blue-500"
},
{
"message": "Community discussions active on forums",
"time": "3 days ago",
"type": "community",
"color": "bg-purple-500"
},
{
"message": "PowerShell Gallery security improvements",
"time": "1 month ago",
"type": "security",
"color": "bg-orange-500"
}
],
"stats": {
"total_topics": 15420,
"total_posts": 85230,
"active_users": 12500,
"topics_this_week": 45
},
"last_updated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"fallback": true
}
EOF
}
else
echo "No Discourse script found, creating default data..."
cat > data/community_stats.json << 'EOF'
{
"activities": [
{
"message": "PowerShell community thriving",
"time": "Ongoing",
"type": "community",
"color": "bg-blue-500"
},
{
"message": "Join our active forums",
"time": "Always",
"type": "invitation",
"color": "bg-green-500"
}
],
"stats": {
"total_topics": 15000,
"total_posts": 80000,
"active_users": 12000,
"topics_this_week": 40
},
"last_updated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)",
"fallback": true
}
EOF
fi
- name: Verify community stats file exists
run: |
if [ -f data/community_stats.json ]; then
echo "Community stats file created successfully"
cat data/community_stats.json
else
echo "Community stats file not found"
exit 1
fi
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
rm -rf docs
hugo \
--gc \
--minify \
--destination docs
- name: Add .nojekyll file
run: touch docs/.nojekyll
- name: Commit and push to main
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/ || echo "No docs directory to add"
if [ -f data/community_stats.json ]; then
git add data/community_stats.json
fi
if ! git diff --staged --quiet; then
git commit -m "Deploy Hugo site to docs/ [skip ci]"
git push
else
echo "No changes to commit"
fi