Skip to content

Commit

Permalink
feat: add deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincoln Lee authored and Lincoln Lee committed Jul 19, 2024
1 parent 6b4f927 commit b49e0cc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,35 @@ jobs:
with:
push: true
tags: nwplus/dinubot:latest
-
name: Upload systemd service file
uses: actions/upload-artifact@v3
with:
name: dinubot-service-file
path: ./dinubot.service

deploy:
runs-on: self-hosted
needs: dockerize

steps:
- name: Download systemd service file
uses: actions/download-artifact@v3
with:
name: dinubot-service-file
path: .

- name: Pull Docker image
run: docker pull nwplus/dinubot:latest

- name: Run Docker container
- name: Copy systemd service file
run: sudo cp dinubot.service /etc/systemd/system/dinubot.service

- name: Reload systemd daemon
run: sudo systemctl daemon-reload

- name: Enable and start Dinubot service
run: |
docker stop dinubot || true
docker rm dinubot || true
docker run -d -p 8000:8000 --name dinubot nwplus/dinubot:latest
sudo systemctl enable dinubot
sudo systemctl start dinubot
18 changes: 18 additions & 0 deletions dinubot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=DinuBot, nwPlus's internal donut bot
After=network.target
[Service]
Type=simple
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu/DinuBot
ExecStart=/usr/bin/docker compose up
ExecStop=/usr/bin/docker compose down
Restart=always
[Install]
WantedBy=multi-user.target
[Service]
Restart=always
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
dinubot:
image: lsha0730/dinubot
image: nwplus/dinubot
build: .
env_file:
- .env
Expand Down

0 comments on commit b49e0cc

Please sign in to comment.