Add deployment step to build workflow for production server
All checks were successful
Test and build Docker image / docker (push) Successful in 21s
All checks were successful
Test and build Docker image / docker (push) Successful in 21s
This commit is contained in:
parent
a025f29179
commit
f1d3204930
1 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,10 @@
|
||||||
# 4. Install uv and ruff for the runner user
|
# 4. Install uv and ruff for the runner user
|
||||||
# 5. Login to GitHub Container Registry:
|
# 5. Login to GitHub Container Registry:
|
||||||
# echo "ghp_YOUR_TOKEN_HERE" | sudo -u forgejo-runner docker login ghcr.io -u TheLovinator1 --password-stdin
|
# echo "ghp_YOUR_TOKEN_HERE" | sudo -u forgejo-runner docker login ghcr.io -u TheLovinator1 --password-stdin
|
||||||
|
# 6. Configure sudoers for deployment (sudo EDITOR=nvim visudo):
|
||||||
|
# forgejo-runner ALL=(discord-rss) NOPASSWD: /usr/bin/git -C /home/discord-rss/discord-rss-bot pull
|
||||||
|
# forgejo-runner ALL=(discord-rss) NOPASSWD: /usr/bin/uv sync -U
|
||||||
|
# forgejo-runner ALL=(root) NOPASSWD: /bin/systemctl restart discord-rss-bot
|
||||||
|
|
||||||
name: Test and build Docker image
|
name: Test and build Docker image
|
||||||
on:
|
on:
|
||||||
|
|
@ -86,3 +90,11 @@ jobs:
|
||||||
else
|
else
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 "${tag_args[@]}" --push .
|
docker buildx build --platform linux/amd64,linux/arm64 "${tag_args[@]}" --push .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Deploy to production server
|
||||||
|
- name: Deploy to Server
|
||||||
|
if: success() && forge.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
sudo -u discord-rss git -C /home/discord-rss/discord-rss-bot pull
|
||||||
|
sudo -u discord-rss uv sync -U
|
||||||
|
sudo systemctl restart discord-rss-bot
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue