Skip to content

Commit 92f1163

Browse files
author
¨tedecti¨
committed
ci/cd
1 parent c0d45dd commit 92f1163

1 file changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/cd_local.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
11
name: CD
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
78

89
jobs:
910
deploy:
1011
runs-on: self-hosted
1112

1213
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
14+
- name: Download Artifact
15+
uses: actions/download-artifact@v4
16+
with:
17+
name: eclipse-app
18+
path: /home/tedecti/eclipse-app
1519

16-
- name: Install .NET SDK
20+
- name: Create systemd service
1721
run: |
18-
sudo pacman -S --noconfirm dotnet-sdk
22+
SERVICE_FILE=/etc/systemd/system/eclipse.service
23+
sudo bash -c "cat > $SERVICE_FILE" <<EOL
24+
[Unit]
25+
Description=Eclipse App
26+
After=network.target
1927
20-
- name: Build and Publish
21-
run: |
22-
dotnet publish ./Eclipse/Eclipse.csproj -c Release -o /home/tedecti/eclipse
28+
[Service]
29+
ExecStart=/usr/bin/dotnet /home/tedecti/eclipse-app/Eclipse.dll
30+
WorkingDirectory=/home/tedecti/eclipse-app
31+
Restart=always
32+
User=tedecti
33+
34+
[Install]
35+
WantedBy=multi-user.target
36+
EOL
37+
38+
sudo systemctl daemon-reload
39+
sudo systemctl enable eclipse
40+
sudo systemctl restart eclipse
2341
24-
- name: Restart Service
42+
- name: Check app health
2543
run: |
26-
sudo systemctl restart eclipse.service
44+
sleep 5
45+
curl -I http://localhost:8080 || echo "App not responding"

0 commit comments

Comments
 (0)